59 assert(is_string(
$id));
66 if (substr(
$id, 0, 6) ===
'saml2:') {
70 $this->config =
$metadata->getMetaDataConfig(substr(
$id, 6),
'saml20-idp-hosted');
71 } elseif (substr(
$id, 0, 6) ===
'saml1:') {
75 $this->config =
$metadata->getMetaDataConfig(substr(
$id, 6),
'shib13-idp-hosted');
76 } elseif (substr(
$id, 0, 5) ===
'adfs:') {
80 $this->config =
$metadata->getMetaDataConfig(substr(
$id, 5),
'adfs-idp-hosted');
84 $saml2EntityId =
$metadata->getMetaDataCurrentEntityID(
'saml20-idp-hosted');
85 $this->associationGroup =
'saml2:'.$saml2EntityId;
93 if ($this->associationGroup === null) {
97 $auth = $this->config->getString(
'auth');
99 $this->authSource = new \SimpleSAML\Auth\Simple(
$auth);
126 assert(is_string(
$id));
128 if (isset(self::$idpCache[
$id])) {
129 return self::$idpCache[
$id];
147 assert(isset($state[
'core:IdP']));
149 return self::getById($state[
'core:IdP']);
179 if ($prefix ===
'saml') {
190 if ($prefix ===
'adfs') {
199 } elseif (
$spMetadata->hasValue(
'OrganizationDisplayName')) {
200 return $spMetadata->getLocalizedString(
'OrganizationDisplayName');
214 assert(isset($association[
'id']));
215 assert(isset($association[
'Handler']));
220 $session->addAssociation($this->associationGroup, $association);
232 return $session->getAssociations($this->associationGroup);
257 return $this->authSource->isAuthenticated();
268 assert(is_callable($state[
'Responder']));
270 if (isset($state[
'core:SP'])) {
274 $state[
'core:IdP'].
';'.$state[
'core:SP'],
280 call_user_func($state[
'Responder'], $state);
296 if (!
$idp->isAuthenticated()) {
300 $state[
'Attributes'] =
$idp->authSource->getAttributes();
302 if (isset($state[
'SPMetadata'])) {
308 if (isset($state[
'core:SP'])) {
310 $previousSSOTime =
$session->getData(
'core:idp-ssotime', $state[
'core:IdP'].
';'.$state[
'core:SP']);
311 if ($previousSSOTime !== null) {
312 $state[
'PreviousSSOTimestamp'] = $previousSSOTime;
320 $state[
'ReturnCall'] = array(
'SimpleSAML_IdP',
'postAuthProc');
324 $pc->processState($state);
326 self::postAuthProc($state);
341 if (isset($state[
'isPassive']) && (
bool) $state[
'isPassive']) {
342 throw new \SimpleSAML\Module\saml\Error\NoPassive(
'Passive authentication not supported.');
345 $this->authSource->login($state);
363 $sourceImpl = $this->authSource->getAuthSource();
364 if ($sourceImpl === null) {
368 $sourceImpl->reauthenticate($state);
379 assert(isset($state[
'Responder']));
383 if (isset($state[
'SPMetadata'][
'entityid'])) {
385 } elseif (isset($state[
'SPMetadata'][
'entityID'])) {
393 if (isset($state[
'ForceAuthn']) && (
bool) $state[
'ForceAuthn']) {
400 $state[
'IdPMetadata'] = $this->
getConfig()->toArray();
401 $state[
'ReturnCallback'] = array(
'SimpleSAML_IdP',
'postAuth');
430 $logouttype = $this->
getConfig()->getString(
'logouttype',
'traditional');
431 switch ($logouttype) {
433 $handler =
'SimpleSAML\IdP\TraditionalLogoutHandler';
436 $handler =
'SimpleSAML\IdP\IFrameLogoutHandler';
455 assert(isset($state[
'Responder']));
458 call_user_func($state[
'Responder'],
$idp, $state);
474 assert(isset($state[
'Responder']));
478 $state[
'core:TerminatedAssocId'] =
$assocId;
483 $session->deleteData(
'core:idp-ssotime', $this->
id.
':'.$state[
'saml:SPEntityId']);
531 assert(is_string(
$url));
534 'Responder' => array(
'SimpleSAML_IdP',
'finishLogoutRedirect'),
535 'core:Logout:URL' =>
$url,
553 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.
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.
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.
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.