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
0ec1332b
Unverified
Commit
0ec1332b
authored
7 years ago
by
Tim van Dijen
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update YubiKey.php
parent
d2024844
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/authYubiKey/lib/Auth/Source/YubiKey.php
+7
-8
7 additions, 8 deletions
modules/authYubiKey/lib/Auth/Source/YubiKey.php
with
7 additions
and
8 deletions
modules/authYubiKey/lib/Auth/Source/YubiKey.php
+
7
−
8
View file @
0ec1332b
...
...
@@ -133,7 +133,7 @@ class sspmod_authYubiKey_Auth_Source_YubiKey extends SimpleSAML_Auth_Source
assert
(
array_key_exists
(
self
::
AUTHID
,
$state
));
$source
=
SimpleSAML_Auth_Source
::
getById
(
$state
[
self
::
AUTHID
]);
if
(
$source
===
null
)
{
throw
new
Exception
(
'Could not find authentication source with id '
.
$state
[
self
::
AUTHID
]);
throw
new
Exception
(
'Could not find authentication source with id '
.
$state
[
self
::
AUTHID
]);
}
try
{
...
...
@@ -163,7 +163,7 @@ class sspmod_authYubiKey_Auth_Source_YubiKey extends SimpleSAML_Auth_Source
*/
public
static
function
getYubiKeyPrefix
(
$otp
)
{
$uid
=
substr
(
$otp
,
0
,
strlen
(
$otp
)
-
self
::
TOKENSIZE
);
$uid
=
substr
(
$otp
,
0
,
strlen
(
$otp
)
-
self
::
TOKENSIZE
);
return
$uid
;
}
...
...
@@ -176,15 +176,14 @@ class sspmod_authYubiKey_Auth_Source_YubiKey extends SimpleSAML_Auth_Source
*
* Note that both the username and the password are UTF-8 encoded.
*
* @param string $username The username the user wrote.
* @param string $password The password the user wrote.
* @return array Associative array with the users attributes.
* @param string $otp
* @return array Associative array with the users attributes.
*/
protected
function
login
(
$otp
)
{
assert
(
is_string
(
$otp
));
require_once
dirname
(
dirname
(
dirname
(
dirname
(
__FILE__
))))
.
'/libextinc/Yubico.php'
;
require_once
dirname
(
dirname
(
dirname
(
dirname
(
__FILE__
))))
.
'/libextinc/Yubico.php'
;
try
{
$yubi
=
new
Auth_Yubico
(
$this
->
yubi_id
,
$this
->
yubi_key
);
...
...
@@ -192,11 +191,11 @@ class sspmod_authYubiKey_Auth_Source_YubiKey extends SimpleSAML_Auth_Source
$uid
=
self
::
getYubiKeyPrefix
(
$otp
);
$attributes
=
array
(
'uid'
=>
array
(
$uid
));
}
catch
(
Exception
$e
)
{
SimpleSAML\Logger
::
info
(
'YubiKey:'
.
$this
->
authId
.
': Validation error (otp '
.
$otp
.
'), debug output: '
.
$yubi
->
getLastResponse
());
SimpleSAML\Logger
::
info
(
'YubiKey:'
.
$this
->
authId
.
': Validation error (otp '
.
$otp
.
'), debug output: '
.
$yubi
->
getLastResponse
());
throw
new
SimpleSAML_Error_Error
(
'WRONGUSERPASS'
,
$e
);
}
SimpleSAML\Logger
::
info
(
'YubiKey:'
.
$this
->
authId
.
': YubiKey otp '
.
$otp
.
' validated successfully: '
.
$yubi
->
getLastResponse
());
SimpleSAML\Logger
::
info
(
'YubiKey:'
.
$this
->
authId
.
': YubiKey otp '
.
$otp
.
' validated successfully: '
.
$yubi
->
getLastResponse
());
return
$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