Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppHandler ¶
AppHandler is handler that will fail if user is not authorized (based on token + required scope)
func (AppHandler) ServeHTTP ¶
func (ah AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Satisfies the http.Handler interface
type Authorization ¶
type Authorization struct {
// contains filtered or unexported fields
}
Authorization object
func (*Authorization) Middleware ¶
func (a *Authorization) Middleware(h http.Handler) (handler http.Handler)
Middleware returns middleware function that can be used in router.Use()
func (*Authorization) Validate ¶ added in v0.3.0
func (a *Authorization) Validate() (err error)
type Options ¶ added in v0.3.0
type Options struct { // Jwks with private key. If not set, authorization will be disabled, Jwks jwk.Set // As alternative to Jwks, JwksURL can be provided. Middleware will fetch Jwks and auto refresh. // If Jwks is provided, JwksURL will be ignored. JwksURL string // Required scope that needs to be present in token. If given scope is not present // request will be denied. Scope '*' can be set and means any - only key must match. RequiredScope string // Allowes anonymous user - user without token. User info will be null AllowAnonymous bool // Way how to treat invalid user token: anonymous or unauthorized InvalidTokenIsAnonymous bool // Way how to treat users without valid scope: anonymous or unauthorized InvalidScopeIsAnonymous bool // Disable authorization - it will allow all requests and UserInfo will be always nil Disabled bool }
Options is a configuration container to setup Authorization middleware.
func OptionsFromViper ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.