ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
authenticate.php
Go to the documentation of this file.
1<?php
2
4
5if (!array_key_exists('as', $_REQUEST)) {
6 $t = new SimpleSAML_XHTML_Template($config, 'core:authsource_list.tpl.php');
7
8 $t->data['sources'] = SimpleSAML_Auth_Source::getSources();
9 $t->show();
10 exit();
11}
12
13$asId = (string) $_REQUEST['as'];
14$as = new \SimpleSAML\Auth\Simple($asId);
15
16if (array_key_exists('logout', $_REQUEST)) {
17 $as->logout($config->getBasePath().'logout.php');
18}
19
20if (array_key_exists(SimpleSAML_Auth_State::EXCEPTION_PARAM, $_REQUEST)) {
21 // This is just a simple example of an error
22
24 assert('array_key_exists(SimpleSAML_Auth_State::EXCEPTION_DATA, $state)');
26
27 throw $e;
28}
29
30if (!$as->isAuthenticated()) {
31 $url = SimpleSAML\Module::getModuleURL('core/authenticate.php', array('as' => $asId));
32 $params = array(
33 'ErrorURL' => $url,
34 'ReturnTo' => $url,
35 );
36 $as->login($params);
37}
38
39$attributes = $as->getAttributes();
40
41$t = new SimpleSAML_XHTML_Template($config, 'status.php', 'attributes');
42
43$t->data['header'] = '{status:header_saml20_sp}';
44$t->data['attributes'] = $attributes;
45$t->data['nameid'] = !is_null($as->getAuthData('saml:sp:NameID')) ? $as->getAuthData('saml:sp:NameID') : false;
46$t->data['logouturl'] = \SimpleSAML\Utils\HTTP::getSelfURLNoQuery().'?as='.urlencode($asId).'&logout';
47$t->show();
$t
$config
Definition: authenticate.php:3
$as
if(array_key_exists('logout', $_REQUEST)) if(array_key_exists(SimpleSAML_Auth_State::EXCEPTION_PARAM, $_REQUEST)) if(! $as->isAuthenticated()) $attributes
if(!array_key_exists('as', $_REQUEST)) $asId
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
An exception for terminatinating execution or to throw for unit testing.
static getModuleURL($resource, array $parameters=array())
Get absolute URL to a specified module resource.
Definition: Module.php:303
static getSelfURLNoQuery()
Retrieve the current URL using the base URL in the configuration, without the query parameters.
Definition: HTTP.php:846
static getSources()
Retrieve list of authentication sources.
Definition: Source.php:472
const EXCEPTION_DATA
The index in the state array which contains the exception data.
Definition: State.php:75
const EXCEPTION_PARAM
The URL parameter which contains the exception state id.
Definition: State.php:87
static loadExceptionState($id=null)
Retrieve an exception state.
Definition: State.php:381
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
$url
$params
Definition: disable.php:11