mcp: redirect to upstream oauth2 for authentication (#5594)

This commit is contained in:
Denis Mishin 2025-05-01 12:16:44 -04:00 committed by GitHub
parent 5b024a8ada
commit 561b6040b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 166 additions and 9 deletions

View file

@ -68,7 +68,12 @@ func (srv *Handler) Authorize(w http.ResponseWriter, r *http.Request) {
return
}
srv.AuthorizationResponse(ctx, w, r, id, v)
loginURL, ok := srv.relyingParties.GetLoginURLForHost(r.Host, id)
if ok {
http.Redirect(w, r, loginURL, http.StatusFound)
} else {
srv.AuthorizationResponse(ctx, w, r, id, v)
}
}
// AuthorizationResponse generates the successful authorization response