feat: allow CORS for UserInfo API in OIDC (#2313)

This commit is contained in:
Yaodong Yu
2023-09-13 18:11:13 +08:00
committed by GitHub
parent 08a0092974
commit a12ba7fb85
2 changed files with 8 additions and 1 deletions

View File

@ -40,6 +40,13 @@ func CorsFilter(ctx *context.Context) {
return
}
if ctx.Request.RequestURI == "/api/userinfo" {
ctx.Output.Header(headerAllowOrigin, origin)
ctx.Output.Header(headerAllowMethods, "POST, GET, OPTIONS, DELETE")
ctx.Output.Header(headerAllowHeaders, "Content-Type, Authorization")
return
}
if origin != "" && originConf != "" && origin != originConf {
ok, err := object.IsOriginAllowed(origin)
if err != nil {