stdcrpcaccess

package
v0.0.81 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: MIT Imports: 13 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 PermissionsFromContext

func PermissionsFromContext(ctx context.Context) []string

PermissionsFromContext returns permissions from the context.

func WithProcedurePermissions

func WithProcedurePermissions(ctx context.Context, procs []string) context.Context

WithProcedurePermissions returns a context with permission strings.

Types

type AccessControl

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

AccessControl implements a simple access control scheme.

func New

func New(jwkEndpoint string, permMapFn PermissionToProcedure) *AccessControl

New inits the access control.

func (*AccessControl) Close

func (ac *AccessControl) Close(context.Context) error

Close cancels the lifecycle context.

func (*AccessControl) Wrap

func (ac *AccessControl) Wrap(next http.Handler) http.Handler

type AuthBackend

type AuthBackend interface {
	JWKSEndpoint() string
}

AuthBackend represents what is necesary of an auth backend.

type PermissionToProcedure

type PermissionToProcedure func(perm string, _ int) string

PermissionToProcedure is used for an authorization scheme were some permission string is compared to a procedure name.

type RealAuthBackend

type RealAuthBackend string

RealAuthBackend is used when actually deploying.

func (RealAuthBackend) JWKSEndpoint

func (ap RealAuthBackend) JWKSEndpoint() string

Directories

Path Synopsis
Package stdcrpcaccesstest provides testing utilities for testing with access control.
Package stdcrpcaccesstest provides testing utilities for testing with access control.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳