66 assert(
'is_string($id)');
73 if (substr(
$id, 0, 6) ===
'saml2:') {
77 $this->config =
$metadata->getMetaDataConfig(substr(
$id, 6),
'saml20-idp-hosted');
78 } elseif (substr(
$id, 0, 6) ===
'saml1:') {
82 $this->config =
$metadata->getMetaDataConfig(substr(
$id, 6),
'shib13-idp-hosted');
83 } elseif (substr(
$id, 0, 5) ===
'adfs:') {
87 $this->config =
$metadata->getMetaDataConfig(substr(
$id, 5),
'adfs-idp-hosted');
91 $saml2EntityId =
$metadata->getMetaDataCurrentEntityID(
'saml20-idp-hosted');
92 $this->associationGroup =
'saml2:'.$saml2EntityId;
100 if ($this->associationGroup === null) {
104 $auth = $this->config->getString(
'auth');
106 $this->authSource = new \SimpleSAML\Auth\Simple(
$auth);
133 assert(
'is_string($id)');
135 if (isset(self::$idpCache[
$id])) {
136 return self::$idpCache[
$id];
154 assert(
'isset($state["core:IdP"])');
156 return self::getById($state[
'core:IdP']);
180 assert(
'is_string($assocId)');
186 if ($prefix ===
'saml') {
197 if ($prefix ===
'adfs') {
206 } elseif (
$spMetadata->hasValue(
'OrganizationDisplayName')) {
207 return $spMetadata->getLocalizedString(
'OrganizationDisplayName');
221 assert(
'isset($association["id"])');
222 assert(
'isset($association["Handler"])');
227 $session->addAssociation($this->associationGroup, $association);
239 return $session->getAssociations($this->associationGroup);
250 assert(
'is_string($assocId)');
264 return $this->authSource->isAuthenticated();
275 assert(
'is_callable($state["Responder"])');
277 if (isset($state[
'core:SP'])) {
281 $state[
'core:IdP'].
';'.$state[
'core:SP'],
287 call_user_func($state[
'Responder'], $state);
303 if (!
$idp->isAuthenticated()) {
307 $state[
'Attributes'] =
$idp->authSource->getAttributes();
309 if (isset($state[
'SPMetadata'])) {
315 if (isset($state[
'core:SP'])) {
317 $previousSSOTime =
$session->getData(
'core:idp-ssotime', $state[
'core:IdP'].
';'.$state[
'core:SP']);
318 if ($previousSSOTime !== null) {
319 $state[
'PreviousSSOTimestamp'] = $previousSSOTime;
327 $state[
'ReturnCall'] =
array(
'SimpleSAML_IdP',
'postAuthProc');
331 $pc->processState($state);
333 self::postAuthProc($state);
348 if (isset($state[
'isPassive']) && (
bool) $state[
'isPassive']) {
352 $this->authSource->login($state);
370 $sourceImpl = $this->authSource->getAuthSource();
371 if ($sourceImpl === null) {
375 $sourceImpl->reauthenticate($state);
386 assert(
'isset($state["Responder"])');
390 if (isset($state[
'SPMetadata'][
'entityid'])) {
392 } elseif (isset($state[
'SPMetadata'][
'entityID'])) {
400 if (isset($state[
'ForceAuthn']) && (
bool) $state[
'ForceAuthn']) {
407 $state[
'IdPMetadata'] = $this->
getConfig()->toArray();
408 $state[
'ReturnCallback'] =
array(
'SimpleSAML_IdP',
'postAuth');
437 $logouttype = $this->
getConfig()->getString(
'logouttype',
'traditional');
438 switch ($logouttype) {
440 $handler =
'SimpleSAML\IdP\TraditionalLogoutHandler';
443 $handler =
'SimpleSAML\IdP\IFrameLogoutHandler';
462 assert(
'isset($state["Responder"])');
465 call_user_func($state[
'Responder'],
$idp, $state);
481 assert(
'isset($state["Responder"])');
482 assert(
'is_string($assocId) || is_null($assocId)');
485 $state[
'core:TerminatedAssocId'] =
$assocId;
490 $session->deleteData(
'core:idp-ssotime', $this->
id.
':'.$state[
'saml:SPEntityId']);
516 assert(
'is_string($assocId)');
517 assert(
'is_string($relayState) || is_null($relayState)');
538 assert(
'is_string($url)');
541 'Responder' =>
array(
'SimpleSAML_IdP',
'finishLogoutRedirect'),
542 'core:Logout:URL' =>
$url,
560 assert(
'isset($state["core:Logout:URL"])');
handleLogoutRequest(array &$state, $assocId)
Process a logout request.
doLogoutRedirect($url)
Log out, then redirect to a URL.
handleAuthenticationRequest(array &$state)
Process authentication requests.
if(!isset($_REQUEST['ReturnTo'])) $returnTo
static getByState(array &$state)
Retrieve the IdP "owning" the state.
isAuthenticated()
Is the current user authenticated?
static getById($id)
Retrieve an IdP by ID.
static throwException($state, SimpleSAML_Error_Exception $exception)
Throw exception to the state exception handler.
reauthenticate(array &$state)
Re-authenticate the user.
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
$metadata['__DYNAMIC:1__']
handleLogoutResponse($assocId, $relayState, SimpleSAML_Error_Exception $error=null)
Process a logout response.
Class SimpleSAML_Error_NoPassive.
finishLogout(array &$state)
Finish the logout operation.
static getModuleURL($resource, array $parameters=array())
Get absolute URL to a specified module resource.
addAssociation(array $association)
Add an SP association.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
const DATA_TIMEOUT_SESSION_END
This is a timeout value for setData, which indicates that the data should never be deleted...
getLogoutHandler()
Find the logout handler of this IdP.
getConfig()
Retrieve the configuration for this IdP.
static finishLogoutRedirect(SimpleSAML_IdP $idp, array $state)
Redirect to a URL after logout.
terminateAssociation($assocId)
Remove an SP association.
Create styles array
The data for the language used.
getId()
Retrieve the ID of this IdP.
authenticate(array &$state)
Authenticate the user.
getSPName($assocId)
Get SP name.
if(!isset($associations[$assocId])) $association
if(!isset($_REQUEST['association'])) $assocId
__construct($id)
Initialize an IdP.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
getAssociations()
Retrieve list of SP associations.
static getById($authId, $type=null)
Retrieve authentication source.
static getSessionFromRequest()
Retrieves the current session.
static saveState(&$state, $stage, $rawId=false)
Save the state.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
static postAuthProc(array $state)
Called after authproc has run.
static postAuth(array $state)
The user is authenticated.