1
0
Fork 0
mirror of https://github.com/Luzifer/nginx-sso.git synced 2024-10-18 07:34:22 +00:00

Lint: Fix some minor linter errors

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-04-08 01:14:35 +02:00
parent f9d9c025dd
commit 4a72836925
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 8 additions and 7 deletions

View file

@ -144,11 +144,12 @@ func main() {
case syscall.SIGHUP:
if yamlSource, err = loadConfiguration(); err != nil {
log.WithError(err).Error("Unable to reload configuration")
} else {
continue
}
if err = initializeModules(yamlSource); err != nil {
log.WithError(err).Error("Unable to initialize modules")
}
}
default:
log.Fatalf("Received unexpected signal: %v", sig)
@ -167,7 +168,7 @@ func handleAuthRequest(res http.ResponseWriter, r *http.Request) {
switch err {
case plugins.ErrNoValidUserFound:
// 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) {
mainCfg.AuditLog.Log(auditEventValidate, r, map[string]string{"result": "anonymous access granted"}) // #nosec G104 - This is only logging
res.WriteHeader(http.StatusOK)

View file

@ -216,7 +216,7 @@ func (a *AuthGoogleOAuth) getUserFromToken(ctx context.Context, token *oauth2.To
httpClient := conf.Client(ctx, token)
client, err := v2.NewService(ctx, option.WithHTTPClient(httpClient))
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()

View file

@ -93,7 +93,7 @@ func (m MFATOTP) exec(c plugins.MFAConfig) (string, error) {
}
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)