Skip to content
Snippets Groups Projects
Commit 568fa250 authored by Andjelko Horvat's avatar Andjelko Horvat
Browse files

authtwitter: add force_login (issue #587).

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3295 44740490-163a-0410-bde0-09ae8108e29a
parent 64126794
No related branches found
No related tags found
No related merge requests found
......@@ -189,6 +189,10 @@ $config = array(
'authtwitter:Twitter',
'key' => 'xxxxxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxx',
// Forces the user to enter their credentials to ensure the correct users account is authorized.
// Details: https://dev.twitter.com/docs/api/1/get/oauth/authenticate
'force_login' => FALSE,
),
*/
......
......@@ -23,6 +23,7 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source {
private $key;
private $secret;
private $force_login;
/**
......@@ -42,6 +43,7 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source {
$this->key = $configObject->getString('key');
$this->secret = $configObject->getString('secret');
$this->force_login = $configObject->getBoolean('force_login', FALSE);
}
......@@ -69,7 +71,11 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source {
SimpleSAML_Auth_State::saveState($state, self::STAGE_INIT);
// Authorize the request token
$consumer->getAuthorizeRequest('https://api.twitter.com/oauth/authenticate', $requestToken);
$url = 'https://api.twitter.com/oauth/authenticate';
if ($this->force_login) {
$url = SimpleSAML_Utilities::addURLparameter($url, array('force_login' => 'true'));
}
$consumer->getAuthorizeRequest($url, $requestToken);
}
......
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