function saml_sp_start in SAML Service Provider 8.3
Same name and namespace in other branches
- 8.2 saml_sp.module \saml_sp_start()
- 7.8 saml_sp.module \saml_sp_start()
- 7 saml_sp.module \saml_sp_start()
- 7.2 saml_sp.module \saml_sp_start()
- 7.3 saml_sp.module \saml_sp_start()
- 4.x saml_sp.module \saml_sp_start()
- 3.x saml_sp.module \saml_sp_start()
Start a SAML authentication request.
Parameters
object $idp: The identity provider.
string $callback: A function to call with the results of the SAML authentication process.
boolean $forceAuthn: Whether to require authentication at the IdP regardless of SSO.
Return value
array|string|null The result of the authentication request.
Throws
\OneLogin\Saml2\Error Passed back up the chain from the SAML library.
1 call to saml_sp_start()
- SamlSPDrupalLoginController::initiate in modules/
saml_sp_drupal_login/ src/ Controller/ SamlSPDrupalLoginController.php - Initiate a SAML login for the given IdP.
File
- ./
saml_sp.module, line 269 - SAML Service Provider.
Code
function saml_sp_start($idp, $callback, $forceAuthn = FALSE) {
global $base_url;
$language = \Drupal::languageManager()
->getCurrentLanguage();
if (isset($_GET['returnTo'])) {
// If a returnTo parameter is present, then use that.
$return_to = '/' . $_GET['returnTo'];
}
else {
// By default user is returned to the front page in the same language.
$return_to = Url::fromRoute('<front>')
->toString();
}
$settings = saml_sp__get_settings($idp);
$auth = new SamlSPAuth($settings);
$auth
->setAuthCallback($callback);
return $auth
->login($return_to, [], $forceAuthn);
}