class saml_sp_Auth in SAML Service Provider 7.8
Same name and namespace in other branches
- 7.2 includes/saml_sp.Auth.inc \saml_sp_Auth
- 7.3 includes/saml_sp.Auth.inc \saml_sp_Auth
Hierarchy
- class \saml_sp_Auth extends \OneLogin_Saml2_Auth
Expanded class hierarchy of saml_sp_Auth
File
- includes/
saml_sp.Auth.inc, line 3
View source
class saml_sp_Auth extends OneLogin_Saml2_Auth {
public $auth_callback;
/**
* Set the auth callback for after the response is returned
*/
public function setAuthCallback($callback) {
$this->auth_callback = $callback;
}
/**
* Initiates the SSO process.
*
* @param string $returnTo The target URL the user should be returned to after login.
* @param array $parameters Extra parameters to be added to the GET
*/
public function login($returnTo = null, $parameters = array()) {
assert('is_array($parameters)');
$settings = $this
->getSettings();
$authnRequest = new saml_sp_AuthnRequest($settings);
$samlRequest = $authnRequest
->getRequest();
$parameters['SAMLRequest'] = $samlRequest;
if (!empty($returnTo)) {
$parameters['RelayState'] = $returnTo;
}
else {
$parameters['RelayState'] = OneLogin_Saml2_Utils::getSelfRoutedURLNoQuery();
}
$security = $settings
->getSecurityData();
if (isset($security['authnRequestsSigned']) && $security['authnRequestsSigned']) {
$signature = $this
->buildRequestSignature($samlRequest, $parameters['RelayState']);
$parameters['SigAlg'] = XMLSecurityKey::RSA_SHA1;
$parameters['Signature'] = $signature;
}
// get this necessary information for this IdP
$idp = (object) $settings
->getIdPData();
$all_idps = saml_sp__load_all_idps();
foreach ($all_idps as $this_idp) {
if ($this_idp->entity_id == $idp->entityId) {
$idp->machine_name = $this_idp->machine_name;
}
}
// record the outbound Id of the request
$id = $authnRequest
->getId();
saml_sp__track_request($id, $idp, $this->auth_callback);
if (variable_get('saml_sp__debug', FALSE) && module_exists('devel')) {
return t('This is a debug page, <a href="!url">you can proceed by clicking this link.</a>', array(
'!url' => url($this
->getSSOurl(), array(
'query' => $parameters,
)),
));
}
$this
->redirectTo($this
->getSSOurl(), $parameters);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
saml_sp_Auth:: |
public | property | ||
saml_sp_Auth:: |
public | function | Initiates the SSO process. | |
saml_sp_Auth:: |
public | function | Set the auth callback for after the response is returned |