Skip to content

Commit 56eb4ac

Browse files
committed
openid: Add support for custom extension args.
Thanks to Andjelko Horvat for providing this patch! git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2693 44740490-163a-0410-bde0-09ae8108e29a
1 parent 5c7f689 commit 56eb4ac

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

config-templates/authsources.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@
109109
//'http://axschema.org/contact/country/home',
110110
//'http://axschema.org/pref/language',
111111
),
112+
// custom extension arguments
113+
'extension.args' => array(
114+
//'http://specs.openid.net/extensions/ui/1.0' => array(
115+
// 'mode' => 'popup',
116+
// 'icon' => 'true',
117+
//),
118+
),
112119
),
113120
*/
114121

modules/openid/lib/Auth/Source/OpenIDConsumer.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ class sspmod_openid_Auth_Source_OpenIDConsumer extends SimpleSAML_Auth_Source {
5656
*/
5757
private $validateSReg;
5858

59+
/**
60+
* List of custom extension args
61+
*/
62+
private $extensionArgs;
63+
5964
/**
6065
* Constructor for this authentication source.
6166
*
@@ -80,6 +85,8 @@ public function __construct($info, $config) {
8085
$this->requiredAXAttributes = $cfgParse->getArray('attributes.ax_required', array());
8186

8287
$this->validateSReg = $cfgParse->getBoolean('sreg.validate',TRUE);
88+
89+
$this->extensionArgs = $cfgParse->getArray('extension.args', array());
8390
}
8491

8592

@@ -203,6 +210,14 @@ public function doAuth(array &$state, $openid) {
203210

204211
}
205212

213+
foreach($this->extensionArgs as $ext_ns => $ext_arg) {
214+
if (is_array($ext_arg)) {
215+
foreach($ext_arg as $ext_key => $ext_value) {
216+
$auth_request->addExtensionArg($ext_ns, $ext_key, $ext_value);
217+
}
218+
}
219+
}
220+
206221
// Redirect the user to the OpenID server for authentication.
207222
// Store the token for this authentication so we can verify the
208223
// response.

0 commit comments

Comments
 (0)