improve-for-first-release #1

Merged
jandd merged 4 commits from improve-for-first-release into main 2023-07-24 16:00:42 +00:00
Showing only changes of commit b0daaf956f - Show all commits

View file

@ -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, &notFound) {
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