Skip to content

Commit

Permalink
Fix CORS
Browse files Browse the repository at this point in the history
Needs to be set for all paths e.g. errors, not just the good one!
  • Loading branch information
spjmurray committed Feb 27, 2024
1 parent a92ebfe commit e26a565
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,27 @@ func (h *Handler) PostOauth2V2Login(w http.ResponseWriter, r *http.Request) {
}

func (h *Handler) PostOauth2V2Token(w http.ResponseWriter, r *http.Request) {
h.setCORS(w)

result, err := h.authenticator.OAuth2.Token(w, r)
if err != nil {
errors.HandleError(w, r, err)
return
}

h.setCORS(w)
h.setUncacheable(w)
util.WriteJSONResponse(w, r, http.StatusOK, result)
}

func (h *Handler) GetOauth2V2Jwks(w http.ResponseWriter, r *http.Request) {
h.setCORS(w)

result, err := h.authenticator.JWKS()
if err != nil {
errors.HandleError(w, r, err)
return
}

h.setCORS(w)
h.setUncacheable(w)
util.WriteJSONResponse(w, r, http.StatusOK, result)
}
Expand Down

0 comments on commit e26a565

Please sign in to comment.