auth

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthServer

type AuthServer struct {
	Policy       *authorization.Policy
	RoundTripper *transport.RoundTripper
}

AuthServer acts as a broker between clients and external OAuth2/OIDC providers.

func MustNewAuthServer

func MustNewAuthServer(policy *authorization.Policy) *AuthServer

func NewAuthServer

func NewAuthServer(policy *authorization.Policy) (*AuthServer, error)

func (*AuthServer) EnsureAuthorized

func (s *AuthServer) EnsureAuthorized(ctx context.Context, request *jsonrpc.Request, response *jsonrpc.Response) (*authschema.Token, error)

EnsureAuthorized checks if a request is authorized.

func (*AuthServer) Middleware

func (s *AuthServer) Middleware(next http.Handler) http.Handler

func (*AuthServer) RegisterHandlers

func (s *AuthServer) RegisterHandlers(mux *http.ServeMux)

type Authorizer

type Authorizer func(ctx context.Context, request *jsonrpc.Request, response *jsonrpc.Response) (*authschema.Token, error)

Authorizer is an interceptor function for JSON-RPC calls that returns a Token when authorization is successful or nil otherwise.

type FallbackAuth

type FallbackAuth struct {
	Strict        *AuthServer
	TokenSource   authorization.ProtectedResourceTokenSource
	IdTokenSource authorization.IdTokenSource
}

FallbackAuth is a fallback authorization interceptor

func NewFallbackAuth

func NewFallbackAuth(authServer *AuthServer, tokenSource authorization.ProtectedResourceTokenSource, idTokenSource authorization.IdTokenSource) *FallbackAuth

func (*FallbackAuth) EnsureAuthorized

func (a *FallbackAuth) EnsureAuthorized(ctx context.Context, request *jsonrpc.Request, response *jsonrpc.Response) (*authorization.Token, error)

Jump to

Keyboard shortcuts

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