mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Add SkipLocal2FA option to pam and smtp sources (#17078)
* Add SkipLocal2FA option to other pam and smtp sources Extend #16954 to allow setting skip local 2fa on pam and SMTP authentication sources Signed-off-by: Andrew Thornton <art27@cantab.net> * make SkipLocal2FA omitempty Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
@@ -53,7 +53,7 @@ type Source struct {
|
||||
GroupFilter string // Group Name Filter
|
||||
GroupMemberUID string // Group Attribute containing array of UserUID
|
||||
UserUID string // User Attribute listed in Group
|
||||
SkipLocalTwoFA bool // Skip Local 2fa for users authenticated with this source
|
||||
SkipLocalTwoFA bool `json:",omitempty"` // Skip Local 2fa for users authenticated with this source
|
||||
|
||||
// reference to the loginSource
|
||||
loginSource *login.Source
|
||||
|
@@ -25,7 +25,7 @@ type Source struct {
|
||||
OpenIDConnectAutoDiscoveryURL string
|
||||
CustomURLMapping *CustomURLMapping
|
||||
IconURL string
|
||||
SkipLocalTwoFA bool
|
||||
SkipLocalTwoFA bool `json:",omitempty"`
|
||||
|
||||
// reference to the loginSource
|
||||
loginSource *login.Source
|
||||
|
@@ -19,8 +19,9 @@ import (
|
||||
|
||||
// Source holds configuration for the PAM login source.
|
||||
type Source struct {
|
||||
ServiceName string // pam service (e.g. system-auth)
|
||||
EmailDomain string
|
||||
ServiceName string // pam service (e.g. system-auth)
|
||||
EmailDomain string
|
||||
SkipLocalTwoFA bool `json:",omitempty"` // Skip Local 2fa for users authenticated with this source
|
||||
|
||||
// reference to the loginSource
|
||||
loginSource *login.Source
|
||||
|
@@ -69,3 +69,8 @@ func (source *Source) Authenticate(user *models.User, userName, password string)
|
||||
|
||||
return user, nil
|
||||
}
|
||||
|
||||
// IsSkipLocalTwoFA returns if this source should skip local 2fa for password authentication
|
||||
func (source *Source) IsSkipLocalTwoFA() bool {
|
||||
return source.SkipLocalTwoFA
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ type Source struct {
|
||||
SkipVerify bool
|
||||
HeloHostname string
|
||||
DisableHelo bool
|
||||
SkipLocalTwoFA bool `json:",omitempty"`
|
||||
|
||||
// reference to the loginSource
|
||||
loginSource *login.Source
|
||||
|
@@ -85,3 +85,8 @@ func (source *Source) Authenticate(user *models.User, userName, password string)
|
||||
|
||||
return user, nil
|
||||
}
|
||||
|
||||
// IsSkipLocalTwoFA returns if this source should skip local 2fa for password authentication
|
||||
func (source *Source) IsSkipLocalTwoFA() bool {
|
||||
return source.SkipLocalTwoFA
|
||||
}
|
||||
|
Reference in New Issue
Block a user