4use Psr\Http\Message\ServerRequestInterface;
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) ===
'/') {
70 $path = substr($path, 1);
73 if (substr($path, 0, 4) !==
'http') {
75 $path = $parts[
'scheme'] .
'://' . $parts[
'host'] .
'/' . $path;
78 $this->ctrl->redirectToURL(
80 './sso/index.php?force_mode_apache=1&' .
81 'r=' . urlencode($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');
An exception for terminatinating execution or to throw for unit testing.
Description of class class.
initFromRequest()
Init credentials from request.
__construct(ServerRequestInterface $httpRequest, \ilCtrl $ctrl)
ilAuthFrontendCredentialsApache constructor.
tryAuthenticationOnLoginPage()
Check if an authentication attempt should be done when login page has been called.
Description of class class.
setUsername($a_name)
Set username.
static supportsRedirects()
Are redirects supported?
This class provides processing control methods.
static getHtmlPath($relative_path)
get url of path
Interface of auth credentials.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc