ILIAS  release_8 Revision v8.24
ilAuthFrontendCredentialsApache Class Reference

Description of class class. More...

+ Inheritance diagram for ilAuthFrontendCredentialsApache:
+ Collaboration diagram for ilAuthFrontendCredentialsApache:

Public Member Functions

 __construct (ServerRequestInterface $httpRequest, ilCtrl $ctrl)
 
 tryAuthenticationOnLoginPage ()
 Check if an authentication attempt should be done when login page has been called. More...
 
 initFromRequest ()
 
 hasValidTargetUrl ()
 
 getTargetUrl ()
 
- Public Member Functions inherited from ilAuthFrontendCredentials
 __construct ()
 
 setUsername (string $a_name)
 Set username. More...
 
 getUsername ()
 Get username. More...
 
 setPassword (string $a_password)
 Set password. More...
 
 getPassword ()
 Get password. More...
 
 setAuthMode (string $a_auth_mode)
 Set auth mode. More...
 
 getAuthMode ()
 Get auth mode. More...
 
 setUsername (string $a_name)
 Set username. More...
 
 getUsername ()
 Get username. More...
 
 setPassword (string $a_password)
 Set password. More...
 
 getPassword ()
 Get password. More...
 
 setAuthMode (string $a_auth_mode)
 Set auth mode. More...
 
 getAuthMode ()
 Get auth mode. More...
 

Protected Member Functions

 getSettings ()
 

Private Attributes

ServerRequestInterface $httpRequest
 
ilCtrl $ctrl
 
ilSetting $settings
 
ilLogger $logger
 

Detailed Description

Description of class class.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 30 of file class.ilAuthFrontendCredentialsApache.php.

Constructor & Destructor Documentation

◆ __construct()

ilAuthFrontendCredentialsApache::__construct ( ServerRequestInterface  $httpRequest,
ilCtrl  $ctrl 
)

Definition at line 37 of file class.ilAuthFrontendCredentialsApache.php.

38 {
39 global $DIC;
40 $this->logger = $DIC->logger()->auth();
41 $this->httpRequest = $httpRequest;
42 $this->ctrl = $ctrl;
43 $this->settings = new ilSetting('apache_auth');
45 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $ctrl, $DIC, $httpRequest, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\logger(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ getSettings()

ilAuthFrontendCredentialsApache::getSettings ( )
protected

Definition at line 98 of file class.ilAuthFrontendCredentialsApache.php.

References $settings.

Referenced by initFromRequest(), and tryAuthenticationOnLoginPage().

+ Here is the caller graph for this function:

◆ getTargetUrl()

ilAuthFrontendCredentialsApache::getTargetUrl ( )

Definition at line 143 of file class.ilAuthFrontendCredentialsApache.php.

143 : string
144 {
145 return ilUtil::appendUrlParameterString(trim($this->httpRequest->getQueryParams()['r']), 'passed_sso=1');
146 }
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)

References ilUtil\appendUrlParameterString().

+ Here is the call graph for this function:

◆ hasValidTargetUrl()

ilAuthFrontendCredentialsApache::hasValidTargetUrl ( )

Definition at line 123 of file class.ilAuthFrontendCredentialsApache.php.

123 : bool
124 {
125 $targetUrl = trim((string) ($this->httpRequest->getQueryParams()['r'] ?? ''));
126 if ($targetUrl === '') {
127 return false;
128 }
129
130 $validDomains = [];
131 $path = ILIAS_DATA_DIR . '/' . CLIENT_ID . '/apache_auth_allowed_domains.txt';
132 if (file_exists($path) && is_readable($path)) {
133 foreach (file($path) as $line) {
134 if (trim($line)) {
135 $validDomains[] = trim($line);
136 }
137 }
138 }
139
140 return (new ilWhiteListUrlValidator($targetUrl, $validDomains))->isValid();
141 }
Class ilWhiteListUrlValidator.
const CLIENT_ID
Definition: constants.php:41
const ILIAS_DATA_DIR
Definition: constants.php:44
$path
Definition: ltiservices.php:32

References $path, CLIENT_ID, and ILIAS_DATA_DIR.

◆ initFromRequest()

ilAuthFrontendCredentialsApache::initFromRequest ( )

Definition at line 103 of file class.ilAuthFrontendCredentialsApache.php.

103 : void
104 {
105 $mappingFieldName = $this->getSettings()->get('apache_auth_username_direct_mapping_fieldname', '');
106
107 $this->logger->dump($this->httpRequest->getServerParams(), ilLogLevel::DEBUG);
108 $this->logger->debug($mappingFieldName);
109
110 switch ($this->getSettings()->get('apache_auth_username_config_type')) {
112 if (isset($this->httpRequest->getServerParams()[$mappingFieldName])) {
113 $this->setUsername($this->httpRequest->getServerParams()[$mappingFieldName]);
114 }
115 break;
116
119 break;
120 }
121 }
setUsername(string $a_name)
Set username.

References ilAuthProviderApache\APACHE_AUTH_TYPE_BY_FUNCTION, ilAuthProviderApache\APACHE_AUTH_TYPE_DIRECT_MAPPING, ilLogLevel\DEBUG, getSettings(), ApacheCustom\getUsername(), ILIAS\Repository\logger(), and ilAuthFrontendCredentials\setUsername().

+ Here is the call graph for this function:

◆ tryAuthenticationOnLoginPage()

ilAuthFrontendCredentialsApache::tryAuthenticationOnLoginPage ( )

Check if an authentication attempt should be done when login page has been called.

Redirects in case no apache authentication has been tried before (GET['passed_sso'])

Definition at line 51 of file class.ilAuthFrontendCredentialsApache.php.

51 : void
52 {
53 $cmd = (string) ($this->httpRequest->getQueryParams()['cmd'] ?? '');
54 if ('' === $cmd) {
55 $cmd = (string) ($this->httpRequest->getParsedBody()['cmd'] ?? '');
56 }
57
58 if ('force_login' === $cmd) {
59 return;
60 }
61
62 if (!$this->getSettings()->get('apache_enable_auth', '0')) {
63 return;
64 }
65
66 if (!$this->getSettings()->get('apache_auth_authenticate_on_login_page', '0')) {
67 return;
68 }
69
70 if (
71 (defined('IL_CERT_SSO') && (int) IL_CERT_SSO === 1) ||
73 isset($this->httpRequest->getQueryParams()['passed_sso'])
74 ) {
75 return;
76 }
77
78 $path = (string) ($this->httpRequest->getServerParams()['REQUEST_URI'] ?? '');
79 if (strpos($path, '/') === 0) {
80 $path = substr($path, 1);
81 }
82
83 if (strpos($path, 'http') !== 0) {
84 $parts = parse_url(ILIAS_HTTP_PATH);
85 $path = $parts['scheme'] . '://' . $parts['host'] . '/' . $path;
86 }
87
88 $this->ctrl->redirectToURL(
90 './sso/index.php?force_mode_apache=1&' .
91 'r=' . urlencode($path) .
92 '&cookie_path=' . urlencode(IL_COOKIE_PATH) .
93 '&ilias_path=' . urlencode(ILIAS_HTTP_PATH)
94 )
95 );
96 }
static supportsRedirects()
Are redirects supported?
static getHtmlPath(string $relative_path)
get url of path
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64
const IL_COOKIE_PATH(isset($_GET["client_id"]))
Definition: metadata.php:64

References $parts, $path, ILIAS\Repository\ctrl(), ilUtil\getHtmlPath(), getSettings(), IL_COOKIE_PATH, ILIAS\Repository\int(), and ilContext\supportsRedirects().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilAuthFrontendCredentialsApache::$ctrl
private

Definition at line 33 of file class.ilAuthFrontendCredentialsApache.php.

Referenced by __construct().

◆ $httpRequest

ServerRequestInterface ilAuthFrontendCredentialsApache::$httpRequest
private

Definition at line 32 of file class.ilAuthFrontendCredentialsApache.php.

Referenced by __construct().

◆ $logger

ilLogger ilAuthFrontendCredentialsApache::$logger
private

Definition at line 35 of file class.ilAuthFrontendCredentialsApache.php.

◆ $settings

ilSetting ilAuthFrontendCredentialsApache::$settings
private

Definition at line 34 of file class.ilAuthFrontendCredentialsApache.php.

Referenced by getSettings().


The documentation for this class was generated from the following file: