mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
fix(oidc): multiple state cookies being sent to frontend causing invalid oauth state
This commit is contained in:
parent
453262832a
commit
a1f2a84a16
1 changed files with 1 additions and 7 deletions
|
@ -1,7 +1,6 @@
|
||||||
package auth
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/yusing/go-proxy/internal/common"
|
"github.com/yusing/go-proxy/internal/common"
|
||||||
|
@ -49,12 +48,7 @@ func RequireAuth(next http.HandlerFunc) http.HandlerFunc {
|
||||||
}
|
}
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if err := defaultAuth.CheckToken(r); err != nil {
|
if err := defaultAuth.CheckToken(r); err != nil {
|
||||||
if IsFrontend(r) {
|
gphttp.Unauthorized(w, err.Error())
|
||||||
r = r.WithContext(context.WithValue(r.Context(), nextHandlerContextKey, next))
|
|
||||||
defaultAuth.LoginHandler(w, r)
|
|
||||||
} else {
|
|
||||||
gphttp.Unauthorized(w, err.Error())
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
next(w, r)
|
next(w, r)
|
||||||
|
|
Loading…
Add table
Reference in a new issue