Documentation ¶
Index ¶
- Variables
- func WithAuthzAllowByDefault() func(*AuthHandler)
- func WithHTTPClient(client pkg.HTTPClient) func(*AuthHandler)
- func WithJWKSetCache(jwkSetCache pkg.FrontierJWKCache) func(*AuthHandler)
- func WithRESTEndpoint(endpoint *url.URL) func(*AuthHandler)
- func WithResourceControlMapping(rcm map[ResourcePath]ResourceControlFunc) func(*AuthHandler)
- type AuthHandler
- type ResourceControl
- type ResourceControlFunc
- type ResourcePath
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // AuthenticatedUserContextKey is context key that contains the user object AuthenticatedUserContextKey = contextKey{/* contains filtered or unexported fields */} // UserTokenContextKey context key that contains jwt token UserTokenContextKey = contextKey{"user-token"} // TokenClaimsContextKey context key that contains jwt token claims TokenClaimsContextKey = contextKey{"token-claims"} )
View Source
var (
RestEndpoint = strings.TrimSpace(os.Getenv("FRONTIER_REST_ENDPOINT"))
)
Functions ¶
func WithAuthzAllowByDefault ¶
func WithAuthzAllowByDefault() func(*AuthHandler)
func WithHTTPClient ¶
func WithHTTPClient(client pkg.HTTPClient) func(*AuthHandler)
func WithJWKSetCache ¶
func WithJWKSetCache(jwkSetCache pkg.FrontierJWKCache) func(*AuthHandler)
func WithRESTEndpoint ¶
func WithRESTEndpoint(endpoint *url.URL) func(*AuthHandler)
WithRESTEndpoint provides url for frontier server For e.g. http://localhost:7400
func WithResourceControlMapping ¶
func WithResourceControlMapping(rcm map[ResourcePath]ResourceControlFunc) func(*AuthHandler)
Types ¶
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
func NewAuthHandler ¶
func NewAuthHandler(opts ...func(auth *AuthHandler)) (*AuthHandler, error)
NewAuthHandler creates a middleware for net/http router that checks all incoming requests for valid authorization. WithAuthorization is done using either user json web token in WithAuthorization header or session cookies. Add this middleware on routes that needs to be protected via Frontier
func (*AuthHandler) MapRequestToResource ¶
func (ea *AuthHandler) MapRequestToResource(r *http.Request) (ResourceControl, bool)
func (*AuthHandler) WithAuthentication ¶
func (ea *AuthHandler) WithAuthentication(base http.Handler) http.HandlerFunc
func (*AuthHandler) WithAuthorization ¶
func (ea *AuthHandler) WithAuthorization(base http.Handler) http.HandlerFunc
type ResourceControl ¶
type ResourceControlFunc ¶
type ResourceControlFunc func(*http.Request) ResourceControl
type ResourcePath ¶
Click to show internal directories.
Click to hide internal directories.