mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-28 04:35:40 +00:00
chore: rename whitelist to oauth whitelist
This commit is contained in:
@@ -6,16 +6,16 @@ import (
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
func NewAuth(userList types.Users, whitelist []string) *Auth {
|
||||
func NewAuth(userList types.Users, oauthWhitelist []string) *Auth {
|
||||
return &Auth{
|
||||
Users: userList,
|
||||
Whitelist: whitelist,
|
||||
Users: userList,
|
||||
OAuthWhitelist: oauthWhitelist,
|
||||
}
|
||||
}
|
||||
|
||||
type Auth struct {
|
||||
Users types.Users
|
||||
Whitelist []string
|
||||
Users types.Users
|
||||
OAuthWhitelist []string
|
||||
}
|
||||
|
||||
func (auth *Auth) GetUser(email string) *types.User {
|
||||
@@ -33,10 +33,10 @@ func (auth *Auth) CheckPassword(user types.User, password string) bool {
|
||||
}
|
||||
|
||||
func (auth *Auth) EmailWhitelisted(emailSrc string) bool {
|
||||
if len(auth.Whitelist) == 0 {
|
||||
if len(auth.OAuthWhitelist) == 0 {
|
||||
return true
|
||||
}
|
||||
for _, email := range auth.Whitelist {
|
||||
for _, email := range auth.OAuthWhitelist {
|
||||
if email == emailSrc {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ type Config struct {
|
||||
GenericTokenURL string `mapstructure:"generic-token-url"`
|
||||
GenericUserURL string `mapstructure:"generic-user-info-url"`
|
||||
DisableContinue bool `mapstructure:"disable-continue"`
|
||||
Whitelist string `mapstructure:"whitelist"`
|
||||
OAuthWhitelist string `mapstructure:"oauth-whitelist"`
|
||||
CookieExpiry int `mapstructure:"cookie-expiry"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user