From 48051ad20d93f93bfccd79cf5471b7a3c8a54350 Mon Sep 17 00:00:00 2001 From: "Thomas @ BeeDesk" Date: Fri, 18 Jan 2019 19:38:58 -0800 Subject: [PATCH] Allowed empty string for config.JWT.Authenticator. Defaulted to bearer-jwt-token for back-compat. (Thanks calavera for the suggestion.) --- api/auth.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/api/auth.go b/api/auth.go index f1d4afb..784a67c 100644 --- a/api/auth.go +++ b/api/auth.go @@ -47,16 +47,12 @@ func NewAuthWithVersion(ctx context.Context, version string) *Auth { auth := &Auth{version: version} authenticatorName := config.JWT.Authenticator - if (authenticatorName == "bearer-jwt-token") { + if (authenticatorName == "bearer-jwt-token" || authenticatorName == "") { auth.authenticator = &JWTAuthenticator{name: "bearer-jwt-token", auth: *auth} } else if (authenticatorName == "bearer-okta-jwt-token") { auth.authenticator = &OktaJWTAuthenticator{name: "bearer-okta-jwt-token", auth: *auth} } else { - if (authenticatorName != "") { - logrus.Fatal("Authenticator `" + authenticatorName + "` is not recognized") - } else { - logrus.Fatal("Authenticator is not defined") - } + logrus.Fatal("Authenticator `" + authenticatorName + "` is not recognized") } auth.authorizer = &RolesAuthorizer{name: "bearer-jwt-token-roles", auth: *auth}