|
const | STAGE_INIT = 'twitter:init' |
| The string used to identify our states. More...
|
|
const | AUTHID = 'twitter:AuthId' |
| The key of the AuthId field in the state. More...
|
|
Definition at line 11 of file Twitter.php.
◆ __construct()
sspmod_authtwitter_Auth_Source_Twitter::__construct |
( |
|
$info, |
|
|
|
$config |
|
) |
| |
Constructor for this authentication source.
- Parameters
-
array | $info | Information about this authentication source. |
array | $config | Configuration. |
Definition at line 49 of file Twitter.php.
References $config, $info, and SimpleSAML_Configuration\loadFromArray().
51 assert(is_array(
$info));
59 $this->key = $configObject->getString(
'key');
60 $this->secret = $configObject->getString(
'secret');
61 $this->force_login = $configObject->getBoolean(
'force_login',
false);
62 $this->include_email = $configObject->getBoolean(
'include_email',
false);
static loadFromArray($config, $location='[ARRAY]', $instance=null)
Loads a configuration from the given array.
◆ authenticate()
sspmod_authtwitter_Auth_Source_Twitter::authenticate |
( |
& |
$state | ) |
|
Log-in using Twitter platform.
- Parameters
-
array | &$state | Information about the current authentication. |
Definition at line 71 of file Twitter.php.
References SimpleSAML_Auth_Source\$authId, $state, $url, SimpleSAML\Logger\debug(), SimpleSAML\Module\getModuleURL(), and SimpleSAML_Auth_State\saveState().
83 $requestToken = $consumer->getRequestToken(
'https://api.twitter.com/oauth/request_token', array(
'oauth_callback' => $linkback));
85 $requestToken->key .
"] with the secret [" . $requestToken->secret .
"]");
87 $state[
'authtwitter:authdata:requestToken'] = $requestToken;
91 $url =
'https://api.twitter.com/oauth/authenticate';
92 if ($this->force_login) {
93 $url = \SimpleSAML\Utils\HTTP::addURLParameters(
$url, array(
'force_login' =>
'true'));
95 $consumer->getAuthorizeRequest(
$url, $requestToken);
static getModuleURL($resource, array $parameters=array())
Get absolute URL to a specified module resource.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
static saveState(&$state, $stage, $rawId=false)
Save the state.
◆ finalStep()
sspmod_authtwitter_Auth_Source_Twitter::finalStep |
( |
& |
$state | ) |
|
Definition at line 99 of file Twitter.php.
References $attributes, $key, $state, and SimpleSAML\Logger\debug().
101 $requestToken =
$state[
'authtwitter:authdata:requestToken'];
102 $parameters = array();
104 if (!isset($_REQUEST[
'oauth_token'])) {
107 if ($requestToken->key !== (
string)$_REQUEST[
'oauth_token']) {
111 if (!isset($_REQUEST[
'oauth_verifier'])) {
114 $parameters[
'oauth_verifier'] = (string)$_REQUEST[
'oauth_verifier'];
119 $requestToken->key .
"] with the secret [" . $requestToken->secret .
"]");
122 $accessToken = $consumer->getAccessToken(
'https://api.twitter.com/oauth/access_token', $requestToken, $parameters);
124 $accessToken->key .
"] with the secret [" . $accessToken->secret .
"]");
126 $verify_credentials_url =
'https://api.twitter.com/1.1/account/verify_credentials.json';
127 if ($this->include_email) {
128 $verify_credentials_url = $verify_credentials_url .
'?include_email=true';
130 $userdata = $consumer->getUserInfo($verify_credentials_url, $accessToken);
132 if (!isset($userdata[
'id_str']) || !isset($userdata[
'screen_name'])) {
137 foreach ($userdata as
$key => $value) {
138 if (is_string($value)) {
143 $attributes[
'twitter_at_screen_name'] = array(
'@' . $userdata[
'screen_name']);
144 $attributes[
'twitter_screen_n_realm'] = array($userdata[
'screen_name'] .
'@twitter.com');
145 $attributes[
'twitter_targetedID'] = array(
'http://twitter.com!' . $userdata[
'id_str']);
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
if(array_key_exists('yes', $_REQUEST)) $attributes
◆ $force_login
sspmod_authtwitter_Auth_Source_Twitter::$force_login |
|
private |
◆ $include_email
sspmod_authtwitter_Auth_Source_Twitter::$include_email |
|
private |
◆ $key
sspmod_authtwitter_Auth_Source_Twitter::$key |
|
private |
◆ $secret
sspmod_authtwitter_Auth_Source_Twitter::$secret |
|
private |
◆ AUTHID
const sspmod_authtwitter_Auth_Source_Twitter::AUTHID = 'twitter:AuthId' |
The key of the AuthId field in the state.
Definition at line 21 of file Twitter.php.
◆ STAGE_INIT
const sspmod_authtwitter_Auth_Source_Twitter::STAGE_INIT = 'twitter:init' |
The string used to identify our states.
Definition at line 16 of file Twitter.php.
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/authtwitter/lib/Auth/Source/Twitter.php