mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2024-11-24 08:52:25 +02:00
6fb3274ca3
Reorganized the structure of the Request Utils due to their widespread use resulting in circular imports issues (mostly because of middleware & logger).
21 lines
493 B
Go
21 lines
493 B
Go
package middleware
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/justinas/alice"
|
|
middlewareapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
|
|
)
|
|
|
|
func NewScope(reverseProxy bool) alice.Constructor {
|
|
return func(next http.Handler) http.Handler {
|
|
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
|
scope := &middlewareapi.RequestScope{
|
|
ReverseProxy: reverseProxy,
|
|
}
|
|
req = middlewareapi.AddRequestScope(req, scope)
|
|
next.ServeHTTP(rw, req)
|
|
})
|
|
}
|
|
}
|