package
0.0.0-20230101183712-202847b4b89b
Repository: https://github.com/corestoreio/csfw.git
Documentation: pkg.go.dev

# Packages

Package backendjwt defines the backend configuration options and element slices.

# Functions

FromContext returns the csjwt.Token in ctx if it exists or an error.
MustNew same as New() but panics on error.
New creates a new token service.
NewOptionFactories creates a new struct and initializes the internal map for the registration of different option factories.
OptionsError helper function to be used within the backend package or other sub-packages whose functions may return an OptionFactoryFunc.
SetHeaderAuthorization convenience function to set the Authorization Bearer Header on a request for a given token.
WithBlocklist sets a new global block list service.
WithDebugLog creates a new standard library based logger with debug mode enabled.
WithDefaultConfig applies the default JWT configuration settings based for a specific scope.
WithDisable disables the current service and calls the next HTTP handler.
WithErrorHandler adds a custom error handler.
WithExpiration sets expiration duration depending on the scope.
WithKey sets the key for the default signing method of 256 bits.
WithLogger convenient helper function to apply a logger to the Service type.
WithMarkPartiallyApplied if set to true marks a configuration for a scope as partially applied with functional options set via source code.
WithOptionFactory applies a function which lazily loads the options from a slow backend (config.Getter) depending on the incoming scope within a request.
WithRootConfig sets the root configuration service to retrieve the scoped base configuration.
WithServiceErrorHandler sets the error handler on the Service object.
WithSigningMethod this option function lets you overwrite the default 256 bit signing method for a specific scope.
WithSingleTokenUsage if set to true for each request a token can be only used once.
WithSkew sets the duration of time skew we allow between signer and verifier.
WithStoreCodeFieldName sets the name of the key in the token claims section to extract the store code.
WithTemplateToken set a custom csjwt.Header and csjwt.Claimer for each scope when parsing a token in a request.
WithUnauthorizedHandler adds a custom handler when a token cannot authorized to call the next handler in the chain.

# Constants

DefaultExpire duration when a token expires.
DefaultSigningMethod HMAC-SHA signing with 512 bits.
DefaultSkew duration of time skew we allow between signer and verifier.
StoreCodeFieldName defines the key in the claim where the store code has been stored.

# Structs

OptionFactories allows to register multiple OptionFactoryFunc identified by their names.
ScopedConfig contains the configuration for a scope.
Service main type for handling JWT authentication, generation, blockLists and log outs depending on a scope.

# Interfaces

Blocklister a backend storage to handle blocked tokens.
IDGenerator represents the interface to generate a new UUID aka JWT ID.
StoreFinder see store.Finder for a description.

# Type aliases

Option can be used as an argument in NewService to configure it with different settings.
OptionFactoryFunc a closure around a scoped configuration to figure out which options should be returned depending on the scope brought to you during a request.