authrpc

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 5 Imported by: 0

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 ErrorMapper func(error) *jsonrpc.Error

type Option

type Option func(*options)

func WithDeniedError

func WithDeniedError(mapper DeniedError) Option

func WithErrorMapper

func WithErrorMapper(mapper ErrorMapper) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL