Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LemonLDAP NG
lemonldap-ng
Commits
48f93404
Commit
48f93404
authored
Jun 30, 2021
by
Marek Wójtowicz
Browse files
Support for multiple yubikeys.
parent
c9bf13aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm
View file @
48f93404
...
...
@@ -86,7 +86,7 @@ sub init {
sub
_findYubikey
{
my
(
$self
,
$req
,
$sessionInfo
)
=
@_
;
my
(
$yubikey
,
$
_2fDevices
);
my
(
$yubikey
,
$
_2fDevices
,
$code
);
# First, lookup from session attribute
if
(
$self
->
conf
->
{
yubikey2fFromSessionAttribute
}
)
{
...
...
@@ -109,8 +109,14 @@ sub _findYubikey {
$self
->
logger
->
debug
("
2F Device(s) found
");
$self
->
logger
->
debug
("
Reading Yubikey ...
");
$yubikey
=
$_
->
{
_yubikey
}
foreach
grep
{
$_
->
{
type
}
eq
'
UBK
'
}
@$
_2fDevices
;
if
(
$code
=
$req
->
param
('
code
')
)
{
$yubikey
=
$_
->
{
_yubikey
}
foreach
grep
{
(
$_
->
{
type
}
eq
'
UBK
')
and
(
$_
->
{
_yubikey
}
eq
substr
(
$code
,
0
,
$self
->
conf
->
{
yubikey2fPublicIDSize
}
)
)
}
@$
_2fDevices
;
}
else
{
$yubikey
=
$_
->
{
_yubikey
}
foreach
grep
{
$_
->
{
type
}
eq
'
UBK
'
}
@$
_2fDevices
;
}
}
return
$yubikey
;
...
...
@@ -168,11 +174,7 @@ sub verify {
# Verify OTP
my
$yubikey
=
$self
->
_findYubikey
(
$req
,
$session
);
if
(
index
(
$yubikey
,
substr
(
$code
,
0
,
$self
->
conf
->
{
yubikey2fPublicIDSize
}
)
)
==
-
1
)
{
unless
(
$yubikey
)
{
$self
->
userLogger
->
warn
('
Yubikey not registered
');
return
PE_BADOTP
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment