Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
ca664c09
Commit
ca664c09
authored
Aug 01, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(auth) totp add plugin metadata, for
https://github.com/opnsense/core/issues/1085
parent
d4ec273e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
LocalTOTP.php
src/opnsense/mvc/app/library/OPNsense/Auth/LocalTOTP.php
+51
-0
No files found.
src/opnsense/mvc/app/library/OPNsense/Auth/LocalTOTP.php
View file @
ca664c09
...
...
@@ -191,4 +191,55 @@ class LocalTOTP extends Local
return
false
;
}
/**
* retrieve configuration options
* @return array
*/
public
function
getConfigurationOptions
()
{
$fields
=
array
();
$fields
[
"otpLength"
]
=
array
();
$fields
[
"otpLength"
][
"name"
]
=
gettext
(
"Token length"
);
$fields
[
"otpLength"
][
"type"
]
=
"dropdown"
;
$fields
[
"otpLength"
][
"default"
]
=
6
;
$fields
[
"otpLength"
][
"options"
]
=
array
();
$fields
[
"otpLength"
][
"options"
][
"6"
]
=
"6"
;
$fields
[
"otpLength"
][
"options"
][
"8"
]
=
"8"
;
$fields
[
"otpLength"
][
"help"
]
=
gettext
(
"Token length to use"
);
$fields
[
"otpLength"
][
"validate"
]
=
function
(
$value
)
{
if
(
!
in_array
(
$value
,
array
(
6
,
8
)))
{
return
array
(
gettext
(
"Only token lengths of 6 or 8 characters are supported"
));
}
else
{
return
array
();
}
};
$fields
[
"timeWindow"
]
=
array
();
$fields
[
"timeWindow"
][
"name"
]
=
gettext
(
"Time window"
);
$fields
[
"timeWindow"
][
"type"
]
=
"text"
;
$fields
[
"timeWindow"
][
"default"
]
=
null
;
$fields
[
"timeWindow"
][
"help"
]
=
gettext
(
"The time period in which the token will be valid,"
.
" default is 30 seconds (google authenticator)"
)
;
$fields
[
"timeWindow"
][
"validate"
]
=
function
(
$value
)
{
if
(
!
empty
(
$value
)
&&
filter_var
(
$value
,
FILTER_SANITIZE_NUMBER_INT
)
!=
$value
)
{
return
array
(
gettext
(
"Please enter a valid time window in seconds"
));
}
else
{
return
array
();
}
};
$fields
[
"graceperiod"
]
=
array
();
$fields
[
"graceperiod"
][
"name"
]
=
gettext
(
"Grace period"
);
$fields
[
"graceperiod"
][
"type"
]
=
"text"
;
$fields
[
"graceperiod"
][
"default"
]
=
null
;
$fields
[
"graceperiod"
][
"help"
]
=
gettext
(
"Time in seconds in which this server and the token may differ,"
.
" default is 10 seconds. Set higher for a less secure easier match."
);
$fields
[
"graceperiod"
][
"validate"
]
=
function
(
$value
)
{
if
(
!
empty
(
$value
)
&&
filter_var
(
$value
,
FILTER_SANITIZE_NUMBER_INT
)
!=
$value
)
{
return
array
(
gettext
(
"Please enter a valid grace period in seconds"
));
}
else
{
return
array
();
}
};
return
$fields
;
}
}
Write
Preview
Markdown
is supported
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