Documentation ¶
Index ¶
- func RandomBytes(n int) ([]byte, error)
- type HMACStrategy
- func (c *HMACStrategy) Generate(ctx context.Context) (string, string, error)
- func (c *HMACStrategy) GenerateHMACForString(ctx context.Context, text string) (string, error)
- func (c *HMACStrategy) Signature(token string) string
- func (c *HMACStrategy) Validate(ctx context.Context, token string) (err error)
- type HMACStrategyConfigurator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomBytes ¶
RandomBytes returns n random bytes by reading from crypto/rand.Reader
Types ¶
type HMACStrategy ¶
type HMACStrategy struct { sync.Mutex Config HMACStrategyConfigurator }
HMACStrategy is responsible for generating and validating challenges.
func (*HMACStrategy) Generate ¶
Generate generates a token and a matching signature or returns an error. This method implements rfc6819 Section 5.1.4.2.2: Use High Entropy for Secrets.
func (*HMACStrategy) GenerateHMACForString ¶
func (*HMACStrategy) Signature ¶
func (c *HMACStrategy) Signature(token string) string
type HMACStrategyConfigurator ¶
type HMACStrategyConfigurator interface { oauth2.TokenEntropyProvider oauth2.GlobalSecretProvider oauth2.RotatedGlobalSecretsProvider oauth2.HMACHashingProvider }
Click to show internal directories.
Click to hide internal directories.