improve-for-first-release #1
1 changed files with 17 additions and 4 deletions
|
@ -109,11 +109,24 @@ func (h *LoginHandler) handleGet(
|
|||
) {
|
||||
loginRequest, err := h.adminClient.GetLoginRequest(admin.NewGetLoginRequestParams().WithLoginChallenge(challenge))
|
||||
if err != nil {
|
||||
h.logger.Warnf("could not get login request for challenge %s: %v", challenge, err)
|
||||
h.logger.WithError(err).WithField(
|
||||
"challenge", challenge,
|
||||
).Warn("could not get login request for challenge")
|
||||
|
||||
var e *admin.GetLoginRequestGone
|
||||
if errors.As(err, &e) {
|
||||
w.Header().Set("Location", *e.GetPayload().RedirectTo)
|
||||
var notFound *admin.GetLoginRequestNotFound
|
||||
|
||||
if errors.As(err, ¬Found) {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
|
||||
http.Error(w, notFound.GetPayload().ErrorDescription, http.StatusNotFound)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var gone *admin.GetLoginRequestGone
|
||||
|
||||
if errors.As(err, &gone) {
|
||||
w.Header().Set("Location", *gone.GetPayload().RedirectTo)
|
||||
w.WriteHeader(http.StatusGone)
|
||||
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue