Documentation
¶
Index ¶
- Constants
- func NewService(options ...ConfigOption) auth.TokenService
- type ConfigOption
- func WithCookieDomain(domain string) ConfigOption
- func WithCookieMaxAge(age int) ConfigOption
- func WithDB(db Rediser) ConfigOption
- func WithEntropy(entropy io.Reader) ConfigOption
- func WithIssuer(issuer string) ConfigOption
- func WithLogger(l log.Logger) ConfigOption
- func WithOTP(o auth.OTPService) ConfigOption
- func WithSecret(secret string) ConfigOption
- func WithTokenExpiry(expiresIn time.Duration) ConfigOption
- type Rediser
Constants ¶
const ClientIDCookie = "CLIENTID"
ClientIDCookie is the cookie name used to set the token's ClientID value on a client.
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
func NewService(options ...ConfigOption) auth.TokenService
NewService returns a new TokenService.
Types ¶
type ConfigOption ¶
type ConfigOption func(*service)
ConfigOption configures the service.
func WithCookieDomain ¶
func WithCookieDomain(domain string) ConfigOption
WithCookieDomain configures the service with the domain for a secure cookie.
func WithCookieMaxAge ¶
func WithCookieMaxAge(age int) ConfigOption
WithCookieMaxAge sets the max age for an HTTP cookie. Defaults to 7 days.
func WithEntropy ¶
func WithEntropy(entropy io.Reader) ConfigOption
WithEntropy configures the client with random entropy for generating ULIDs.
func WithIssuer ¶
func WithIssuer(issuer string) ConfigOption
WithIssuer is the issuer identity for the JWT token.
func WithLogger ¶
func WithLogger(l log.Logger) ConfigOption
WithLogger configures the service with a logger.
func WithOTP ¶
func WithOTP(o auth.OTPService) ConfigOption
WithOTP configures the service with an OTP management service.
func WithSecret ¶
func WithSecret(secret string) ConfigOption
WithSecret configures the service with a secret value for signing functions.
func WithTokenExpiry ¶
func WithTokenExpiry(expiresIn time.Duration) ConfigOption
WithTokenExpiry defines how long tokens are valid for. The default value is 20 minutes.