Documentation
¶
Index ¶
- type Config
- type ConfigOption
- func WithAudience(aud string) ConfigOption
- func WithDisableAudienceValidation(disable bool) ConfigOption
- func WithHSKey(hKey []byte) ConfigOption
- func WithRSAPubKey(rsaPubKey *rsa.PublicKey) ConfigOption
- func WithValidateScopeFunc(scopeFunc func(tokenClaims []byte, scopes []string) error) ConfigOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Algorithm jwt.Algorithm
// ScopeMapping should hold full rpc methods, given by
// grpc.UnaryServerInfo.FullMethod, mapped to a slice of
// allowed scopes. Only the methods here will be protected
// by auth.
ScopeMapping map[string][]string
// ValidateScopeFunc is a user defined func for validating a token
// has the correct scopes. This will take in the decoded token json and
// unmarshal into any struct the user wants. See the test files for examples.
ValidateScopeFunc func(tokenClaims []byte, scopes []string) error
Audience string
DisableAudienceValidation bool
// HSKey for use with HS algorithms
HSKey []byte
// RSAPublicKey for use with RS algorithms
RSAPublicKey *rsa.PublicKey
// contains filtered or unexported fields
}
Config auth details
type ConfigOption ¶
type ConfigOption func(*Config)
ConfigOption for setting optional values
func WithDisableAudienceValidation ¶
func WithDisableAudienceValidation(disable bool) ConfigOption
WithDisableAudienceValidation sets the WithDisableAudienceValidation option
func WithRSAPubKey ¶
func WithRSAPubKey(rsaPubKey *rsa.PublicKey) ConfigOption
WithRSAPubKey sets the RSA public key
func WithValidateScopeFunc ¶
func WithValidateScopeFunc(scopeFunc func(tokenClaims []byte, scopes []string) error) ConfigOption
WithValidateScopeFunc sets the ValidateScopeFunc option
Click to show internal directories.
Click to hide internal directories.