stdcrpcaccess

package
v0.0.94 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package stdcrpcaccess implements access control for our RPC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FixedKeyServer added in v0.0.83

func FixedKeyServer() *httptest.Server

FixedKeyServer starts a server for testing that serves the key set.

func SignToken added in v0.0.83

func SignToken(tok openid.Token) (string, error)

SignToken signs a valid JWT against a well-known private key for testing.

func WithFixedAuthBackend added in v0.0.83

func WithFixedAuthBackend() fx.Option

WithFixedAuthBackend injects dependencies for allowing tests to sign and validate access tokens.

func WithSignedToken added in v0.0.83

func WithSignedToken(base connect.HTTPClient, createToken func(r *http.Request) openid.Token) connect.HTTPClient

WithSignedToken is a http client middleware that always adds a valid (self signed) token for testing.

Types

type AccessControl

type AccessControl[T Claims] struct {
	// contains filtered or unexported fields
}

AccessControl implements a simple access control scheme.

func New

func New[T Claims](jwkEndpoint string) *AccessControl[T]

New inits the access control.

func (*AccessControl[T]) Close

func (ac *AccessControl[T]) Close(context.Context) error

Close cancels the lifecycle context.

func (*AccessControl[T]) Wrap

func (ac *AccessControl[T]) Wrap(next http.Handler) http.Handler

type AuthBackend

type AuthBackend interface {
	JWKSEndpoint() string
}

AuthBackend represents what is required of an auth backend.

type Claims added in v0.0.94

type Claims interface {
	ProcedurePermissions() []string
	DecorateContext(ctx context.Context) context.Context
}

Claims constrains the type that will hold authentication claims.

type FixedAuthBackend added in v0.0.83

type FixedAuthBackend struct {
	// contains filtered or unexported fields
}

FixedAuthBackend is an auth backend that is run locally and we control the signing process for.

func (FixedAuthBackend) JWKSEndpoint added in v0.0.83

func (ap FixedAuthBackend) JWKSEndpoint() string

type RealAuthBackend

type RealAuthBackend string

RealAuthBackend is used when actually deploying.

func (RealAuthBackend) JWKSEndpoint

func (ap RealAuthBackend) JWKSEndpoint() string

Jump to

Keyboard shortcuts

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