|
const | STAGE_INIT = 'authwindowslive:init' |
| The string used to identify our states. More...
|
|
const | AUTHID = 'authwindowslive:AuthId' |
| The key of the AuthId field in the state. More...
|
|
Definition at line 10 of file LiveID.php.
◆ __construct()
sspmod_authwindowslive_Auth_Source_LiveID::__construct |
( |
|
$info, |
|
|
|
$config |
|
) |
| |
Constructor for this authentication source.
- Parameters
-
array | $info | Information about this authentication source. |
array | $config | Configuration. |
- Exceptions
-
Exception | In case of misconfiguration. |
Definition at line 35 of file LiveID.php.
References $config, and $info.
37 assert(
'is_array($info)');
38 assert(
'is_array($config)');
43 if (!array_key_exists(
'key',
$config)) {
44 throw new Exception(
'LiveID authentication source is not properly configured: missing [key]');
49 if (!array_key_exists(
'secret',
$config)) {
50 throw new Exception(
'LiveID authentication source is not properly configured: missing [secret]');
53 $this->secret =
$config[
'secret'];
◆ authenticate()
sspmod_authwindowslive_Auth_Source_LiveID::authenticate |
( |
& |
$state | ) |
|
Log-in using LiveID platform.
- Parameters
-
array | &$state | Information about the current authentication. |
Definition at line 62 of file LiveID.php.
References SimpleSAML_Auth_Source\$authId, $state, SimpleSAML\Logger\debug(), SimpleSAML\Utils\HTTP\redirectTrustedURL(), and SimpleSAML_Auth_State\saveState().
64 assert(
'is_array($state)');
76 $authorizeURL =
'https://login.microsoftonline.com/common/oauth2/v2.0/authorize' 77 .
'?client_id=' . $this->key
78 .
'&response_type=code' 79 .
'&response_mode=query' 80 .
'&redirect_uri=' . urlencode(
SimpleSAML\Module::getModuleUrl(
'authwindowslive') .
'/linkback.php')
81 .
'&state=' . urlencode($stateID)
82 .
'&scope=' . urlencode(
'openid https://graph.microsoft.com/user.read')
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Attribute-related utility methods.
static saveState(&$state, $stage, $rawId=false)
Save the state.
◆ finalStep()
sspmod_authwindowslive_Auth_Source_LiveID::finalStep |
( |
& |
$state | ) |
|
- Parameters
-
- Exceptions
-
Definition at line 94 of file LiveID.php.
References $attributes, $data, $key, $postData, $response, $result, $state, $userdata, array, SimpleSAML\Logger\debug(), and SimpleSAML\Utils\HTTP\fetch().
97 "authwindowslive oauth: Using this verification code [".
$state[
'authwindowslive:verification_code'].
"]" 103 $postData =
'client_id=' . urlencode($this->key)
104 .
'&client_secret=' . urlencode($this->secret)
105 .
'&scope=' . urlencode(
'https://graph.microsoft.com/user.read')
106 .
'&grant_type=authorization_code' 107 .
'&redirect_uri=' . urlencode(
SimpleSAML\Module::getModuleUrl(
'authwindowslive') .
'/linkback.php')
108 .
'&code=' . urlencode(
$state[
'authwindowslive:verification_code']);
113 'header' =>
'Content-type: application/x-www-form-urlencoded',
123 if (!array_key_exists(
'access_token',
$response)) {
126 "\r\nNo access_token returned - cannot proceed\r\n" . implode(
', ',
$response[
'error_codes'])
131 "authwindowslive: Got an access token from the OAuth service provider [".
$response[
'access_token'].
"]" 135 $opts =
array(
'http' =>
array(
'header' =>
"Accept: application/json\r\nAuthorization: Bearer ".
141 if (!array_key_exists(
'@odata.context',
$userdata) || array_key_exists(
'error',
$userdata)) {
143 'Unable to retrieve userdata from Microsoft Graph ['.
$userdata[
'error'][
'code'].
'] '.
149 'https://graph.microsoft.com!'.(!empty(
$userdata[
'id']) ?
$userdata[
'id'] :
'unknown')
152 if (is_string($value)) {
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Attribute-related utility methods.
static fetch($url, $context=array(), $getHeaders=false)
Helper function to retrieve a file or URL with proxy support, also supporting proxy basic authorizati...
Create styles array
The data for the language used.
if($session===NULL) $postData
◆ $key
sspmod_authwindowslive_Auth_Source_LiveID::$key |
|
private |
◆ $secret
sspmod_authwindowslive_Auth_Source_LiveID::$secret |
|
private |
◆ AUTHID
const sspmod_authwindowslive_Auth_Source_LiveID::AUTHID = 'authwindowslive:AuthId' |
The key of the AuthId field in the state.
Definition at line 21 of file LiveID.php.
◆ STAGE_INIT
const sspmod_authwindowslive_Auth_Source_LiveID::STAGE_INIT = 'authwindowslive:init' |
The string used to identify our states.
Definition at line 16 of file LiveID.php.
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/authwindowslive/lib/Auth/Source/LiveID.php