-
-
Notifications
You must be signed in to change notification settings - Fork 503
Expand file tree
/
Copy pathsso.php
More file actions
25 lines (20 loc) · 683 Bytes
/
sso.php
File metadata and controls
25 lines (20 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
/**
* SAMPLE Code to demonstrate how to initiate a SAML Authorization request
*
* When the user visits this URL, the browser will be redirected to the SSO
* IdP with an authorization request. If successful, it will then be
* redirected to the consume URL (specified in settings) with the auth
* details.
*/
session_start();
require_once dirname(__DIR__).'/_toolkit_loader.php';
use OneLogin\Saml2\Auth;
use OneLogin\Saml2\Utils;
$auth = new OneLogin\Saml2\Auth();
if (!isset($_SESSION['samlUserdata'])) {
return $auth->login();
} else {
$indexUrl = str_replace('/sso.php', '/index.php', Utils::getSelfURLNoQuery());
return Utils::redirect($indexUrl);
}