stdauthnfx

package
v0.0.196 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// prefix to recognize our API keys.
	APIKeyPrefix = "bwak_"
)

Variables

This section is empty.

Functions

func APIKeyFingerprint added in v0.0.192

func APIKeyFingerprint(ctx context.Context) ([]byte, bool)

func FromContext added in v0.0.191

func FromContext(ctx context.Context) *stdauthnfxv1.Access

func New

func New(deps struct {
	fx.In
	Config    Config
	Validator protovalidate.Validator
	Hasher    func() hash.Hash `name:"api_key"`
},
) (res struct {
	fx.Out
	AccessControl *AccessControl
}, err error,
)

func Provide

func Provide() fx.Option

func WithAPIKeyFingerprint added in v0.0.192

func WithAPIKeyFingerprint(ctx context.Context, hash hash.Hash, data []byte) context.Context

func WithAccess added in v0.0.191

func WithAnonymousAccess added in v0.0.191

func WithAnonymousAccess(ctx context.Context, val protovalidate.Validator) context.Context

func WithWebUserAccess added in v0.0.191

func WithWebUserAccess(
	ctx context.Context, val protovalidate.Validator, info *stdauthnfxv1.AccessIdentity,
) context.Context

Types

type AccessControl added in v0.0.191

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

func (*AccessControl) Authenticate added in v0.0.191

func (ac *AccessControl) Authenticate(ctx context.Context, authzHeader string) (context.Context, error)

Authenticate a HTTP authorization header value. If an empty string is passed, it is considered as not set and the "anonymous" access behavior is triggered.

func (*AccessControl) BuildAndSignAPIKey added in v0.0.191

func (ac *AccessControl) BuildAndSignAPIKey(acc *stdauthnfxv1.Access) (string, error)

BuildAndSignAPIKey takes an access and signs it as our API keys.

func (*AccessControl) CRPCInterceptor added in v0.0.191

func (ac *AccessControl) CRPCInterceptor() connect.Interceptor

func (*AccessControl) GRPCInterceptor added in v0.0.191

func (ac *AccessControl) GRPCInterceptor() grpc.UnaryServerInterceptor

type Config

type Config struct {
	// The base64-encoded key information for signing.
	SigningKeySetBase64 string `env:"SIGNING_KEY_SET_BASE64,required"`
	// SigningKeyID is the id we use for signing
	SigningKeyID string `env:"SIGNING_KEY_ID,required"`
	// Access Token validation JWKS endpoint
	TokenValidationJWKSEndpoint string `env:"TOKEN_VALIDATION_JWKS_ENDPOINT,required"`
	// Access Token issuer to be checked.
	TokenIssuer string `env:"TOKEN_ISSUER,required"`
	// Access Token audience to be checked.
	TokenAudience string `env:"TOKEN_AUDIENCE,required"`
	// Configure a fixed wall-clock time as far as token validation is concerned. Only useful in testing.
	FixedWallClockTimestamp int64 `env:"FIXED_WALL_CLOCK_TIMESTAMP"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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