21    const AUTHID = 
'authwindowslive:AuthId';
 
   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'];
 
   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')
 
   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.
An exception for terminatinating execution or to throw for unit testing.
static fetch($url, $context=array(), $getHeaders=false)
Helper function to retrieve a file or URL with proxy support, also supporting proxy basic authorizati...
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
static saveState(&$state, $stage, $rawId=false)
Save the state.
__construct($info, $config)
Constructor for this authentication source.
const AUTHID
The key of the AuthId field in the state.
authenticate(&$state)
Log-in using LiveID platform.
const STAGE_INIT
The string used to identify our states.
Attribute-related utility methods.
if($session===NULL) $postData