Documentation
¶
Overview ¶
Package authrpc provides the legacy fail-closed JSON-RPC authorization middleware.
Deprecated: use github.com/faustbrian/go-authorization/adapters/jsonrpc. This package remains supported for the longer of 180 days after successor public availability and two subsequently published stable root-module minor releases.
Index ¶
Constants ¶
View Source
const CodeForbidden = -32001
Variables ¶
View Source
var ( ErrNilAuthorizer = adapter.ErrNilAuthorizer ErrNilRequestMapper = adapter.ErrNilRequestMapper )
Functions ¶
func DecisionFromContext ¶
func DecisionFromContext(ctx context.Context) (authorization.Decision, bool)
func NewMiddleware ¶
func NewMiddleware( authorizer Authorizer, mapper RequestMapper, middlewareOptions ...Option, ) (jsonrpc.Middleware, error)
Types ¶
type Authorizer ¶
type Authorizer interface {
Decide(context.Context, authorization.Request) (authorization.Decision, error)
}
type DeniedError ¶
type DeniedError func(authorization.Decision) *jsonrpc.Error
type ErrorMapper ¶
type Option ¶
type Option func(*options)
func WithDeniedError ¶
func WithDeniedError(mapper DeniedError) Option
func WithErrorMapper ¶
func WithErrorMapper(mapper ErrorMapper) Option
type RequestMapper ¶
type RequestMapper func(context.Context, json.RawMessage) (authorization.Request, error)
Click to show internal directories.
Click to hide internal directories.