mirror of
https://github.com/Luzifer/nginx-sso.git
synced 2024-12-20 12:51:17 +00:00
Lint: Fix some minor linter errors
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
f9d9c025dd
commit
4a72836925
3 changed files with 8 additions and 7 deletions
7
main.go
7
main.go
|
@ -144,11 +144,12 @@ func main() {
|
||||||
case syscall.SIGHUP:
|
case syscall.SIGHUP:
|
||||||
if yamlSource, err = loadConfiguration(); err != nil {
|
if yamlSource, err = loadConfiguration(); err != nil {
|
||||||
log.WithError(err).Error("Unable to reload configuration")
|
log.WithError(err).Error("Unable to reload configuration")
|
||||||
} else {
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if err = initializeModules(yamlSource); err != nil {
|
if err = initializeModules(yamlSource); err != nil {
|
||||||
log.WithError(err).Error("Unable to initialize modules")
|
log.WithError(err).Error("Unable to initialize modules")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log.Fatalf("Received unexpected signal: %v", sig)
|
log.Fatalf("Received unexpected signal: %v", sig)
|
||||||
|
@ -167,7 +168,7 @@ func handleAuthRequest(res http.ResponseWriter, r *http.Request) {
|
||||||
switch err {
|
switch err {
|
||||||
case plugins.ErrNoValidUserFound:
|
case plugins.ErrNoValidUserFound:
|
||||||
// No valid user found, check whether special anonymous "user" has access
|
// No valid user found, check whether special anonymous "user" has access
|
||||||
// Username is set to 0x0 character to prevent accidential whitelist-match
|
// Username is set to 0x0 character to prevent accidental whitelist-match
|
||||||
if mainCfg.ACL.HasAccess(string(0x0), nil, r) {
|
if mainCfg.ACL.HasAccess(string(0x0), nil, r) {
|
||||||
mainCfg.AuditLog.Log(auditEventValidate, r, map[string]string{"result": "anonymous access granted"}) // #nosec G104 - This is only logging
|
mainCfg.AuditLog.Log(auditEventValidate, r, map[string]string{"result": "anonymous access granted"}) // #nosec G104 - This is only logging
|
||||||
res.WriteHeader(http.StatusOK)
|
res.WriteHeader(http.StatusOK)
|
||||||
|
|
|
@ -216,7 +216,7 @@ func (a *AuthGoogleOAuth) getUserFromToken(ctx context.Context, token *oauth2.To
|
||||||
httpClient := conf.Client(ctx, token)
|
httpClient := conf.Client(ctx, token)
|
||||||
client, err := v2.NewService(ctx, option.WithHTTPClient(httpClient))
|
client, err := v2.NewService(ctx, option.WithHTTPClient(httpClient))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errors.Wrap(err, "Unable to instanciate OAuth2 API service")
|
return "", errors.Wrap(err, "Unable to instantiate OAuth2 API service")
|
||||||
}
|
}
|
||||||
|
|
||||||
tok, err := client.Tokeninfo().Context(ctx).Do()
|
tok, err := client.Tokeninfo().Context(ctx).Do()
|
||||||
|
|
|
@ -93,7 +93,7 @@ func (m MFATOTP) exec(c plugins.MFAConfig) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if n := len(secret) % 8; n != 0 {
|
if n := len(secret) % 8; n != 0 {
|
||||||
secret = secret + strings.Repeat("=", 8-n)
|
secret += strings.Repeat("=", 8-n)
|
||||||
}
|
}
|
||||||
|
|
||||||
return totp.GenerateCodeCustom(strings.ToUpper(secret), time.Now(), generatorOpts)
|
return totp.GenerateCodeCustom(strings.ToUpper(secret), time.Now(), generatorOpts)
|
||||||
|
|
Loading…
Reference in a new issue