1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-30 10:49:40 +02:00

refactor(oauth): use oauth2 to generate login url

This commit is contained in:
Chaim Lev Ari 2019-01-18 10:13:33 +02:00
parent 0a439b3893
commit c28274667d
5 changed files with 63 additions and 37 deletions

View file

@ -17,10 +17,6 @@ type authenticatePayload struct {
Password string
}
type oauthPayload struct {
Code string
}
type authenticateResponse struct {
JWT string `json:"jwt"`
}
@ -35,13 +31,6 @@ func (payload *authenticatePayload) Validate(r *http.Request) error {
return nil
}
func (payload *oauthPayload) Validate(r *http.Request) error {
if govalidator.IsNull(payload.Code) {
return portainer.Error("Invalid OAuth authorization code")
}
return nil
}
func (handler *Handler) authenticate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
if handler.authDisabled {
return &httperror.HandlerError{http.StatusServiceUnavailable, "Cannot authenticate user. Portainer was started with the --no-auth flag", ErrAuthDisabled}