Skip to content

Commit d4eb665

Browse files
committed
Add a function to populate the token
1 parent 925f088 commit d4eb665

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/Authentication/AuthTokens/OIDCAuthToken.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ abstract class OIDCAuthToken implements IAuthentication
99
private $userDetails = null;
1010
private $authorities = array();
1111
private $principal;
12+
protected $acceptedIssuers;
13+
protected $authRealm;
1214

1315
/**
1416
* {@see IAuthentication::eraseCredentials()}
@@ -97,4 +99,17 @@ public static function isStateless()
9799
{
98100
return true;
99101
}
102+
103+
/**
104+
* Set principal/User details from the session.
105+
*/
106+
protected function setTokenFromSession()
107+
{
108+
if (in_array($_SERVER['OIDC_CLAIM_iss'], $this->acceptedIssuers, true)) {
109+
$this->principal = $_SERVER['REMOTE_USER'];
110+
$this->userDetails = array(
111+
'AuthenticationRealm' => array($this->authRealm)
112+
);
113+
}
114+
}
100115
}

0 commit comments

Comments
 (0)