bricks: github.com/pace/bricks/http/oauth2/middleware Index | Files

package middleware

import "github.com/pace/bricks/http/oauth2/middleware"

Index

Package Files

scopes_middleware.go

type RequiredScopes Uses

type RequiredScopes map[string]oauth2.Scope

RequiredScopes defines the scope each endpoint requires

type ScopesMiddleware Uses

type ScopesMiddleware struct {
    RequiredScopes RequiredScopes
}

Deprecated: ScopesMiddleware contains required scopes for each endpoint - For generated APIs use the generated AuthenticationBackend with oauth2.Authorizer and set a Scope

func NewScopesMiddleware Uses

func NewScopesMiddleware(scopes RequiredScopes) *ScopesMiddleware

Deprecated: NewScopesMiddleware return a new scopes middleware - For generated APIs use the generated AuthenticationBackend with oauth2.Authorizer and set a scope

func (*ScopesMiddleware) Handler Uses

func (m *ScopesMiddleware) Handler(next http.Handler) http.Handler

Handler checks if the token extracted from the request's context has the required scope for the requested route and returns a 401 response if not.

Package middleware imports 4 packages (graph). Updated 2019-12-27. Refresh now. Tools for package owners.