13 $requestid =
$query[
'wctx'];
25 'Responder' => array(
'sspmod_adfs_IdP_ADFS',
'sendResponse'),
27 'ForceAuthn' =>
false,
29 'adfs:wctx' => $requestid,
30 'adfs:wreply' => false
33 if (isset(
$query[
'wreply']) && !empty(
$query[
'wreply'])) {
46 $nameidFormat =
'http://schemas.xmlsoap.org/claims/UPN';
50 <wst:RequestSecurityTokenResponse xmlns:wst=
"http://schemas.xmlsoap.org/ws/2005/02/trust">
51 <wst:RequestedSecurityToken>
52 <saml:Assertion Issuer=
"$issuer" IssueInstant=
"$issueInstant" AssertionID=
"$assertionID" MinorVersion=
"1" MajorVersion=
"1" xmlns:saml=
"urn:oasis:names:tc:SAML:1.0:assertion">
53 <saml:Conditions
NotOnOrAfter=
"$assertionExpire" NotBefore=
"$notBefore">
54 <saml:AudienceRestrictionCondition>
55 <saml:Audience>
$target</saml:Audience>
56 </saml:AudienceRestrictionCondition>
58 <saml:AuthenticationStatement AuthenticationMethod=
"urn:oasis:names:tc:SAML:1.0:am:unspecified" AuthenticationInstant=
"$issueInstant">
60 <saml:NameIdentifier Format=
"$nameidFormat">
$nameid</saml:NameIdentifier>
62 </saml:AuthenticationStatement>
63 <saml:AttributeStatement>
65 <saml:NameIdentifier Format=
"$nameidFormat">
$nameid</saml:NameIdentifier>
76 if ((!isset($value)) || ($value ===
'')) {
79 $value = htmlspecialchars($value);
82 <saml:Attribute AttributeNamespace=
"$namespace" AttributeName=
"$name">
83 <saml:AttributeValue>$value</saml:AttributeValue>
91 </saml:AttributeStatement>
93 </wst:RequestedSecurityToken>
94 <wsp:AppliesTo xmlns:wsp=
"http://schemas.xmlsoap.org/ws/2004/09/policy">
95 <wsa:EndpointReference xmlns:wsa=
"http://schemas.xmlsoap.org/ws/2004/08/addressing">
96 <wsa:Address>
$target</wsa:Address>
97 </wsa:EndpointReference>
99 </wst:RequestSecurityTokenResponse>
108 $objXMLSecDSig->idKeys = array(
'AssertionID');
109 $objXMLSecDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
111 $firstassertionroot = $responsedom->getElementsByTagName(
'Assertion')->item(0);
112 $objXMLSecDSig->addReferenceList(
113 array($firstassertionroot), XMLSecurityDSig::SHA256,
114 array(
'http://www.w3.org/2000/09/xmldsig#enveloped-signature', XMLSecurityDSig::EXC_C14N),
115 array(
'id_name' =>
'AssertionID')
119 $objKey->loadKey(
$key,
true);
120 $objXMLSecDSig->sign($objKey);
122 $public_cert = file_get_contents($cert);
123 $objXMLSecDSig->add509Cert($public_cert,
true);
125 $newSig = $responsedom->importNode($objXMLSecDSig->sigNode,
true);
126 $firstassertionroot->appendChild($newSig);
127 return $responsedom->saveXML();
132 $wresult = htmlspecialchars($wresult);
133 $wctx = htmlspecialchars($wctx);
136 <body onload=
"document.forms[0].submit()">
137 <form method=
"post" action=
"$url">
138 <
input type=
"hidden" name=
"wa" value=
"wsignin1.0">
139 <
input type=
"hidden" name=
"wresult" value=
"$wresult">
140 <
input type=
"hidden" name=
"wctx" value=
"$wctx">
142 <
input type=
"submit" value=
"Continue">
160 $nameidattribute =
$spMetadata->getValue(
'simplesaml.nameidattribute');
161 if (!empty($nameidattribute)) {
162 if (!array_key_exists($nameidattribute,
$attributes)) {
163 throw new Exception(
'simplesaml.nameidattribute does not exist in resulting attribute set');
174 $idp->addAssociation(array(
176 'Handler' =>
'sspmod_adfs_IdP_ADFS',
191 if ($algo === null) {
192 $algo =
$idpMetadata->getString(
'signature.algorithm', XMLSecurityKey::RSA_SHA256);
196 $wctx = $state[
'adfs:wctx'];
197 $wreply = $state[
'adfs:wreply'] ? :
$spMetadata->getValue(
'prp');
212 if (isset(
$_GET[
'wreply']) && !empty(
$_GET[
'wreply'])) {
218 'Responder' => array(
'sspmod_adfs_IdP_ADFS',
'sendLogoutResponse'),
handleLogoutRequest(array &$state, $assocId)
Process a logout request.
if($err=$client->getError()) $namespace
static receiveAuthnRequest(SimpleSAML_IdP $idp)
static generateID()
Generate a random identifier, ID_LENGTH bytes long.
doLogoutRedirect($url)
Log out, then redirect to a URL.
static getAttributeNamespace($name, $defaultns)
Extract an attribute's namespace, or revert to default.
handleAuthenticationRequest(array &$state)
Process authentication requests.
if(!isset($_REQUEST['ReturnTo'])) $returnTo
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
static getByState(array &$state)
Retrieve the IdP "owning" the state.
static checkURLAllowed($url, array $trustedSites=null)
Check if a URL is valid and is in our list of allowed URLs.
static signResponse($response, $key, $cert, $algo)
static getLogoutURL(SimpleSAML_IdP $idp, array $association, $relayState)
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
static sendLogoutResponse(SimpleSAML_IdP $idp, array $state)
$metadata['__DYNAMIC:1__']
static generateTimestamp($instant=null)
This function generates a timestamp on the form used by the SAML protocols.
static getModuleURL($resource, array $parameters=array())
Get absolute URL to a specified module resource.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Attribute-related utility methods.
getBaseURL($t, $type='get', $key=null, $value=null)
getConfig()
Retrieve the configuration for this IdP.
static postResponse($url, $wresult, $wctx)
if(array_key_exists('yes', $_REQUEST)) $attributes
catch(Exception $e) if(!($request instanceof \SAML2\ArtifactResolve)) $issuer
if(!isset($associations[$assocId])) $association
static generateResponse($issuer, $target, $nameid, $attributes, $assertionLifetime)
static getCertPath($path)
Resolves a path that may be relative to the cert-directory.
$sc SubjectConfirmationData NotOnOrAfter
if(!isset($_REQUEST['association'])) $assocId
static loadFromArray($config, $location='[ARRAY]', $instance=null)
Loads a configuration from the given array.
static sendResponse(array $state)
static receiveLogoutMessage(SimpleSAML_IdP $idp)