From 44b7e0fdca5c421cd0e9c6fa81e93e1ffad587ca Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Wed, 16 Jan 2019 16:49:33 +0200 Subject: [PATCH 1/3] fix(auth): change error type Co-Authored-By: chiptus --- api/http/handler/auth/authenticate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/http/handler/auth/authenticate.go b/api/http/handler/auth/authenticate.go index a0fbf7c51..eca24a902 100644 --- a/api/http/handler/auth/authenticate.go +++ b/api/http/handler/auth/authenticate.go @@ -106,7 +106,7 @@ func (handler *Handler) authenticateOAuth(w http.ResponseWriter, r *http.Request } if settings.AuthenticationMethod != 3 { - return &httperror.HandlerError{http.StatusForbidden, "OAuth authentication is not being used", err} + return &httperror.HandlerError{http.StatusServiceUnavailable, "Authentication is not configured to use OAuth", err} } token, err := handler.OAuthService.GetAccessToken(payload.Code, &settings.OAuthSettings) From fc8938e8719fdc16031b110c754287c7dc83368e Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Wed, 16 Jan 2019 16:50:19 +0200 Subject: [PATCH 2/3] fix(auth): change oauth error type Co-Authored-By: chiptus --- api/http/handler/auth/authenticate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/http/handler/auth/authenticate.go b/api/http/handler/auth/authenticate.go index eca24a902..eb1b5128d 100644 --- a/api/http/handler/auth/authenticate.go +++ b/api/http/handler/auth/authenticate.go @@ -127,7 +127,7 @@ func (handler *Handler) authenticateOAuth(w http.ResponseWriter, r *http.Request } if u == nil && !settings.OAuthSettings.OAuthAutoCreateUsers { - return &httperror.HandlerError{http.StatusForbidden, "Unregistered account", portainer.ErrUnauthorized} + return &httperror.HandlerError{http.StatusForbidden, "Account must be created inside Portainer beforehand", portainer.ErrUnauthorized} } if u == nil { From c650fe56c29c0a1aeb7066533fd58aee66b1026c Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Wed, 16 Jan 2019 16:53:24 +0200 Subject: [PATCH 3/3] fix(auth): fix typos Co-Authored-By: chiptus --- app/portainer/services/authentication.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/portainer/services/authentication.js b/app/portainer/services/authentication.js index 7b334e10e..39b7ada24 100644 --- a/app/portainer/services/authentication.js +++ b/app/portainer/services/authentication.js @@ -8,7 +8,7 @@ function AuthenticationFactory(Auth, OAuth, jwtHelper, LocalStorage, StateManage var user = {}; service.init = init; - service.oAuthLogin = oAuthLogin; + service.OAuthLogin = OAuthLogin; service.login = login; service.logout = logout; service.isAuthenticated = isAuthenticated; @@ -22,7 +22,7 @@ function AuthenticationFactory(Auth, OAuth, jwtHelper, LocalStorage, StateManage } } - function oAuthLogin(code) { + function OAuthLogin(code) { return OAuth.login({ code: code }).$promise .then(function onLoginSuccess(response) { return setUser(response.jwt);