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
id
auth
Commits
451a4320
Commit
451a4320
authored
Nov 22, 2017
by
ale
Browse files
Add option to enforce 2FA on a service
parent
f9107816
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/authserver.go
View file @
451a4320
...
...
@@ -161,6 +161,7 @@ type BackendSpec struct {
type
ServiceConfig
struct
{
BackendSpecs
[]
*
BackendSpec
`yaml:"backends"`
ChallengeResponse
bool
`yaml:"challenge_response"`
Enforce2FA
bool
`yaml:"enforce_2fa"`
Ratelimits
[]
string
`yaml:"rate_limits"`
...
...
@@ -379,7 +380,7 @@ func (s *Server) authenticateUser(req *auth.Request, serviceConfig *ServiceConfi
// has 2FA enabled or not, and on whether the service itself
// supports challenge-response authentication.
var
resp
*
auth
.
Response
if
user
.
Has2FA
()
{
if
serviceConfig
.
Enforce2FA
||
user
.
Has2FA
()
{
if
serviceConfig
.
ChallengeResponse
{
resp
=
s
.
authenticateUserWith2FA
(
user
,
req
)
}
else
{
...
...
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