Skip to content
Snippets Groups Projects
Commit 0388d164 authored by Olav Morken's avatar Olav Morken
Browse files

openid: Add target parameter + google example.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2626 44740490-163a-0410-bde0-09ae8108e29a
parent 7e6e377b
No related branches found
No related tags found
No related merge requests found
...@@ -92,6 +92,24 @@ $config = array( ...@@ -92,6 +92,24 @@ $config = array(
), ),
*/ */
/*
// Example of an authsource that authenticates against Google.
// See: http://code.google.com/apis/accounts/docs/OpenID.html
'google' => array(
'openid:OpenIDConsumer',
// Googles OpenID endpoint.
'target' => 'https://www.google.com/accounts/o8/id',
// Attributes that google can supply.
'attributes.ax_required' => array(
//'http://axschema.org/namePerson/first',
//'http://axschema.org/namePerson/last',
//'http://axschema.org/contact/email',
//'http://axschema.org/contact/country/home',
//'http://axschema.org/pref/language',
),
),
*/
/* /*
'papi' => array( 'papi' => array(
'authpapi:PAPI', 'authpapi:PAPI',
......
...@@ -24,6 +24,14 @@ require_once('Auth/OpenID/ServerRequest.php'); ...@@ -24,6 +24,14 @@ require_once('Auth/OpenID/ServerRequest.php');
*/ */
class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source { class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source {
/**
* Static openid target to use.
*
* @var string|NULL
*/
private $target;
/** /**
* List of optional attributes. * List of optional attributes.
*/ */
...@@ -56,6 +64,8 @@ class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source { ...@@ -56,6 +64,8 @@ class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source {
$cfgParse = SimpleSAML_Configuration::loadFromArray($config, $cfgParse = SimpleSAML_Configuration::loadFromArray($config,
'Authentication source ' . var_export($this->authId, TRUE)); 'Authentication source ' . var_export($this->authId, TRUE));
$this->target = $cfgParse->getString('target', NULL);
$this->optionalAttributes = $cfgParse->getArray('attributes.optional', array()); $this->optionalAttributes = $cfgParse->getArray('attributes.optional', array());
$this->requiredAttributes = $cfgParse->getArray('attributes.required', array()); $this->requiredAttributes = $cfgParse->getArray('attributes.required', array());
...@@ -76,6 +86,11 @@ class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source { ...@@ -76,6 +86,11 @@ class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source {
assert('is_array($state)'); assert('is_array($state)');
$state['openid:AuthId'] = $this->authId; $state['openid:AuthId'] = $this->authId;
if ($this->target !== NULL) {
$this->doAuth($state, $this->target);
}
$id = SimpleSAML_Auth_State::saveState($state, 'openid:state'); $id = SimpleSAML_Auth_State::saveState($state, 'openid:state');
$url = SimpleSAML_Module::getModuleURL('openid/consumer.php'); $url = SimpleSAML_Module::getModuleURL('openid/consumer.php');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment