Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
03e2b7c0
Unverified
Commit
03e2b7c0
authored
7 years ago
by
Tim van Dijen
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Missing declaration +
PSR-2
+ phpdoc
parent
207249ec
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/authtwitter/lib/Auth/Source/Twitter.php
+30
-12
30 additions, 12 deletions
modules/authtwitter/lib/Auth/Source/Twitter.php
with
30 additions
and
12 deletions
modules/authtwitter/lib/Auth/Source/Twitter.php
+
30
−
12
View file @
03e2b7c0
...
...
@@ -8,8 +8,8 @@ require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/oauth/lib
* @author Andreas Åkre Solberg, UNINETT AS.
* @package SimpleSAMLphp
*/
class
sspmod_authtwitter_Auth_Source_Twitter
extends
SimpleSAML_Auth_Source
{
class
sspmod_authtwitter_Auth_Source_Twitter
extends
SimpleSAML_Auth_Source
{
/**
* The string used to identify our states.
*/
...
...
@@ -20,10 +20,25 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source {
*/
const
AUTHID
=
'twitter:AuthId'
;
/**
* @var string
*/
private
$key
;
private
$secret
;
/**
* @var string
*/
private
$secret
;
/**
* @var bool
*/
private
$force_login
;
/**
* @var bool
*/
private
$include_email
;
/**
* Constructor for this authentication source.
...
...
@@ -31,19 +46,20 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source {
* @param array $info Information about this authentication source.
* @param array $config Configuration.
*/
public
function
__construct
(
$info
,
$config
)
{
public
function
__construct
(
$info
,
$config
)
{
assert
(
is_array
(
$info
));
assert
(
is_array
(
$config
));
// Call the parent constructor first, as required by the interface
parent
::
__construct
(
$info
,
$config
);
$configObject
=
SimpleSAML_Configuration
::
loadFromArray
(
$config
,
'authsources['
.
var_export
(
$this
->
authId
,
TRUE
)
.
']'
);
$configObject
=
SimpleSAML_Configuration
::
loadFromArray
(
$config
,
'authsources['
.
var_export
(
$this
->
authId
,
true
)
.
']'
);
$this
->
key
=
$configObject
->
getString
(
'key'
);
$this
->
secret
=
$configObject
->
getString
(
'secret'
);
$this
->
force_login
=
$configObject
->
getBoolean
(
'force_login'
,
FALSE
);
$this
->
include_email
=
$configObject
->
getBoolean
(
'include_email'
,
FALSE
);
$this
->
force_login
=
$configObject
->
getBoolean
(
'force_login'
,
false
);
$this
->
include_email
=
$configObject
->
getBoolean
(
'include_email'
,
false
);
}
...
...
@@ -52,7 +68,8 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source {
*
* @param array &$state Information about the current authentication.
*/
public
function
authenticate
(
&
$state
)
{
public
function
authenticate
(
&
$state
)
{
assert
(
is_array
(
$state
));
// We are going to need the authId in order to retrieve this authentication source later
...
...
@@ -79,7 +96,8 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source {
}
public
function
finalStep
(
&
$state
)
{
public
function
finalStep
(
&
$state
)
{
$requestToken
=
$state
[
'authtwitter:authdata:requestToken'
];
$parameters
=
array
();
...
...
@@ -116,9 +134,10 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source {
}
$attributes
=
array
();
foreach
(
$userdata
AS
$key
=>
$value
)
{
if
(
is_string
(
$value
))
foreach
(
$userdata
as
$key
=>
$value
)
{
if
(
is_string
(
$value
))
{
$attributes
[
'twitter.'
.
$key
]
=
array
((
string
)
$value
);
}
}
$attributes
[
'twitter_at_screen_name'
]
=
array
(
'@'
.
$userdata
[
'screen_name'
]);
...
...
@@ -127,5 +146,4 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source {
$state
[
'Attributes'
]
=
$attributes
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment