Documentation ¶
Index ¶
- Constants
- func ForwardAuthorizationHeader(ctx context.Context) (context.Context, error)
- type AuthProxy
- func (h *AuthProxy) HandleAuth(resp http.ResponseWriter, req *http.Request) bool
- func (h *AuthProxy) HandleNotFoundOrAccessDenied(resp http.ResponseWriter, req *http.Request)
- func (h *AuthProxy) WithFixedPostAuthRedirect(path string)
- func (h *AuthProxy) WithPrivateFavicon()
- func (h *AuthProxy) WithPublicPaths(paths ...string)
Constants ¶
const ForwardedHostHeader = "x-forwarded-host"
AlisForwardedHostHeader ia the header used to forward the host with the
Variables ¶
This section is empty.
Functions ¶
func ForwardAuthorizationHeader ¶ added in v0.0.4
ForwardAuthorizationHeader forwards the Authorization header in the incoming ctx to the outgoing ctx. Use this at the very top of your unary and streaming interceptors in the context of a gRPC server
Types ¶
type AuthProxy ¶
type AuthProxy struct {
// contains filtered or unexported fields
}
func New ¶
Creates a new AuthProxy with the given authHost. Example authHost: "https://iam-auth-123456789.europe-west1.run.app".
func (*AuthProxy) HandleAuth ¶
Reverse proxies /auth/* requests to the authHost and validates the access_token cookie set by the authHost for all other requests. If the access token is valid, it also adds it as a header to the request.
Returns true if the request was handled, in which case you should return from the handler.
func (*AuthProxy) HandleNotFoundOrAccessDenied ¶ added in v0.1.8
func (h *AuthProxy) HandleNotFoundOrAccessDenied(resp http.ResponseWriter, req *http.Request)
Reverse proxies to /auth/denied which shows a message in the line of "Not found or you don't have access".
func (*AuthProxy) WithFixedPostAuthRedirect ¶ added in v0.1.7
Hardcodes the path to redirect to after authentication in stead of using the request URI.
func (*AuthProxy) WithPrivateFavicon ¶ added in v0.1.5
func (h *AuthProxy) WithPrivateFavicon()
Exclude favicon.ico from public paths, as its default behavior is to be public.
func (*AuthProxy) WithPublicPaths ¶ added in v0.1.5
Exclude paths from authentication, i.e. no access token is required for these paths. You can specify exact paths or paths with a wildcard (*) at the end. favicon.ico is by default a public path.