From f2d0bc85f259600ccc86adf6720bbd3ec02ef359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Wed, 24 Sep 2008 13:44:46 +0000 Subject: [PATCH] Adding openid auth source in config template and added initopenid script git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@891 44740490-163a-0410-bde0-09ae8108e29a --- config-templates/authsources.php | 5 +++++ modules/openid/www/initopenid.php | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 modules/openid/www/initopenid.php diff --git a/config-templates/authsources.php b/config-templates/authsources.php index 1ff4df491..eca5eff6d 100644 --- a/config-templates/authsources.php +++ b/config-templates/authsources.php @@ -16,6 +16,11 @@ $config = array( 'eduPersonAffiliation' => array('member', 'employee'), 'cn' => array('Test User'), ), + + // Requires you to enable the OpenID module. + 'openid' => array( + 'openid:OpenIDConsumer', + ), 'example-userpass' => array( 'exampleauth:UserPass', diff --git a/modules/openid/www/initopenid.php b/modules/openid/www/initopenid.php new file mode 100644 index 000000000..9db74fa60 --- /dev/null +++ b/modules/openid/www/initopenid.php @@ -0,0 +1,26 @@ +<?php + +/** + * The _include script registers a autoloader for the simpleSAMLphp libraries. It also + * initializes the simpleSAMLphp config class with the correct path. + */ +require_once('_include.php'); + + +/* Load simpleSAMLphp, configuration and metadata */ +$config = SimpleSAML_Configuration::getInstance(); +$session = SimpleSAML_Session::getInstance(); + +if (empty($_REQUEST['RelayState'])) { + SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE'); +} + +if (! $session->isValid('openid') ) { + /* Authenticate with an AuthSource. */ + $hints = array(); + if (array_key_exists('openid', $_REQUEST)) $hints['openid'] = $_REQUEST['openid']; + SimpleSAML_Auth_Default::initLogin('openid', $_REQUEST['RelayState'], NULL, $hints); +} + + +?> \ No newline at end of file -- GitLab