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

openid: support for custom OpenID realm

Thanks to Andjelko Horvat for creating this patch!

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2682 44740490-163a-0410-bde0-09ae8108e29a
parent 41c10121
No related branches found
No related tags found
No related merge requests found
...@@ -99,6 +99,8 @@ $config = array( ...@@ -99,6 +99,8 @@ $config = array(
'openid:OpenIDConsumer', 'openid:OpenIDConsumer',
// Googles OpenID endpoint. // Googles OpenID endpoint.
'target' => 'https://www.google.com/accounts/o8/id', 'target' => 'https://www.google.com/accounts/o8/id',
// Custom realm
// 'realm' => 'http://*.example.org',
// Attributes that google can supply. // Attributes that google can supply.
'attributes.ax_required' => array( 'attributes.ax_required' => array(
//'http://axschema.org/namePerson/first', //'http://axschema.org/namePerson/first',
......
...@@ -31,6 +31,12 @@ class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source { ...@@ -31,6 +31,12 @@ class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source {
*/ */
private $target; private $target;
/**
* Custom realm to use.
*
* @var string|NULL
*/
private $realm;
/** /**
* List of optional attributes. * List of optional attributes.
...@@ -65,6 +71,7 @@ class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source { ...@@ -65,6 +71,7 @@ class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source {
'Authentication source ' . var_export($this->authId, TRUE)); 'Authentication source ' . var_export($this->authId, TRUE));
$this->target = $cfgParse->getString('target', NULL); $this->target = $cfgParse->getString('target', NULL);
$this->realm = $cfgParse->getString('realm', 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());
...@@ -132,7 +139,11 @@ class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source { ...@@ -132,7 +139,11 @@ class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source {
* @return string The trust root. * @return string The trust root.
*/ */
private function getTrustRoot() { private function getTrustRoot() {
return SimpleSAML_Utilities::selfURLhost(); if (!empty($this->realm)) {
return $this->realm;
} else {
return SimpleSAML_Utilities::selfURLhost();
}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment