authenticate: delay evaluation of OIDC provider (#1802)

* authenticate: delay evaluation of OIDC provider

* add additional error message

* address comments
This commit is contained in:
Caleb Doxsey 2021-01-26 09:20:56 -07:00 committed by GitHub
parent a14b65ec3f
commit 5e3aa91f23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 176 additions and 54 deletions

View file

@ -293,7 +293,12 @@ func (a *Authenticate) reauthenticateOrFail(w http.ResponseWriter, r *http.Reque
enc := cryptutil.Encrypt(state.cookieCipher, []byte(redirectURL.String()), b)
b = append(b, enc...)
encodedState := base64.URLEncoding.EncodeToString(b)
httputil.Redirect(w, r, a.provider.Load().GetSignInURL(encodedState), http.StatusFound)
signinURL, err := a.provider.Load().GetSignInURL(encodedState)
if err != nil {
return httputil.NewError(http.StatusInternalServerError,
fmt.Errorf("failed to get sign in url: %w", err))
}
httputil.Redirect(w, r, signinURL, http.StatusFound)
return nil
}