ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
linkback.php
Go to the documentation of this file.
1 <?php
2 
7 if (!array_key_exists('state', $_REQUEST)) {
8  throw new Exception('Lost OAuth Client State');
9 }
11 
12 // http://msdn.microsoft.com/en-us/library/ff749771.aspx
13 if (array_key_exists('code', $_REQUEST)) {
14  // good
15  $state['authwindowslive:verification_code'] = $_REQUEST['code'];
16 
17  if (array_key_exists('exp', $_REQUEST)) {
18  $state['authwindowslive:exp'] = $_REQUEST['exp'];
19  }
20 } else {
21  // In the OAuth WRAP service, error_reason = 'user_denied' means user chose
22  // not to login with LiveID. It isn't clear that this is still true in the
23  // newer API, but the parameter name has changed to error. It doesn't hurt
24  // to preserve support for this, so this is left in as a placeholder.
25  // redirect them to their original page so they can choose another auth mechanism
26  if ($_REQUEST['error'] === 'user_denied') {
29  }
30 
31  // error
32  throw new Exception('Authentication failed: ['.$_REQUEST['error'].'] '.$_REQUEST['error_description']);
33 }
34 
35 // find authentication source
36 assert('array_key_exists(sspmod_authwindowslive_Auth_Source_LiveID::AUTHID, $state)');
38 
40 if ($source === null) {
41  throw new Exception('Could not find authentication source with id '.$sourceId);
42 }
43 
44 $source->finalStep($state);
45 
static throwException($state, SimpleSAML_Error_Exception $exception)
Throw exception to the state exception handler.
Definition: State.php:343
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
if(!array_key_exists(sspmod_authfacebook_Auth_Source_Facebook::AUTHID, $state)) $sourceId
Definition: linkback.php:20
const STAGE_INIT
The string used to identify our states.
Definition: LiveID.php:16
static loadState($id, $stage, $allowMissing=false)
Retrieve saved state.
Definition: State.php:259
static completeAuth(&$state)
Complete authentication.
Definition: Source.php:135
$source
Definition: linkback.php:22
const AUTHID
The key of the AuthId field in the state.
Definition: LiveID.php:21
static getById($authId, $type=null)
Retrieve authentication source.
Definition: Source.php:324