32 parent::__construct();
34 $this->
settings = new \ilSetting(
'apache_auth');
43 $cmd = (string) ($this->httpRequest->getQueryParams()[
'cmd'] ??
'');
45 $cmd = (string) ($this->httpRequest->getParsedBody()[
'cmd'] ??
'');
48 if (
'force_login' === $cmd) {
52 if (!$this->
getSettings()->get(
'apache_enable_auth',
false)) {
56 if (!$this->
getSettings()->get(
'apache_auth_authenticate_on_login_page',
false)) {
62 isset($this->httpRequest->getQueryParams()[
'passed_sso']) ||
63 (defined(
'IL_CERT_SSO') && IL_CERT_SSO ==
'1')
68 $path = (string) ($this->httpRequest->getServerParams()[
'REQUEST_URI'] ??
'');
69 if (substr(
$path, 0, 1) ===
'/') {
73 if (substr(
$path, 0, 4) !==
'http') {
74 $parts = parse_url(ILIAS_HTTP_PATH);
75 $path = $parts[
'scheme'] .
'://' . $parts[
'host'] .
'/' .
$path;
78 $this->ctrl->redirectToURL(
80 './sso/index.php?force_mode_apache=1&' .
81 'r=' . urlencode(
$path) .
83 '&ilias_path=' . urlencode(ILIAS_HTTP_PATH)
101 $mappingFieldName = $this->
getSettings()->get(
'apache_auth_username_direct_mapping_fieldname',
'');
104 $this->
getLogger()->debug($mappingFieldName);
106 switch ($this->
getSettings()->
get(
'apache_auth_username_config_type')) {
107 case \ilAuthProviderApache::APACHE_AUTH_TYPE_DIRECT_MAPPING:
108 if (isset($this->httpRequest->getServerParams()[$mappingFieldName])) {
109 $this->
setUsername($this->httpRequest->getServerParams()[$mappingFieldName]);
113 case \ilAuthProviderApache::APACHE_AUTH_TYPE_BY_FUNCTION:
124 $targetUrl = trim((
string) ($this->httpRequest->getQueryParams()[
'r'] ??
''));
125 if (0 == strlen($targetUrl)) {
129 $validDomains = array();
130 $path = ILIAS_DATA_DIR .
'/' . CLIENT_ID .
'/apache_auth_allowed_domains.txt';
131 if (file_exists(
$path) && is_readable(
$path)) {
132 foreach (file(
$path) as $line) {
134 $validDomains[] = trim($line);
139 $validator = new \ilWhiteListUrlValidator($targetUrl, $validDomains);
141 return $validator->isValid();
149 return \ilUtil::appendUrlParameterString(trim($this->httpRequest->getQueryParams()[
'r']),
'passed_sso=1');
This class provides processing control methods.
Representation of an incoming, server-side HTTP request.
tryAuthenticationOnLoginPage()
Check if an authentication attempt should be done when login page has been called.
Interface of auth credentials.
initFromRequest()
Init credentials from request.
Description of class class.
static getHtmlPath($relative_path)
get url of path
setUsername($a_name)
Set username.
Description of class class.
__construct(ServerRequestInterface $httpRequest, \ilCtrl $ctrl)
ilAuthFrontendCredentialsApache constructor.
static supportsRedirects()
Are redirects supported?