Documentation ¶
Overview ¶
Package auth provides authentication and authorization capability
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Metadata ¶ added in v2.1.0
func Metadata(md map[string]string) func(o *GenerateOptions)
Metadata for the generated account
func Roles ¶ added in v2.1.0
func Roles(rs []*Role) func(o *GenerateOptions)
Roles for the generated account
Types ¶
type Account ¶ added in v2.1.0
type Account struct { // ID of the account (UUID or email) Id string `json: "id"` // Token used to authenticate Token string `json: "token"` // Time of Account creation Created time.Time `json:"created"` // Time of Account expiry Expiry time.Time `json:"expiry"` // Roles associated with the Account Roles []*Role `json:"roles"` // Any other associated metadata Metadata map[string]string `json:"metadata"` }
Account provided by an auth provider
type Auth ¶
type Auth interface { // String to identify the package String() string // Init the auth package Init(opts ...Option) error // Options returns the options set Options() Options // Generate a new auth Account Generate(id string, opts ...GenerateOption) (*Account, error) // Revoke an authorization Account Revoke(token string) error // Validate an account token Validate(token string) (*Account, error) }
Auth providers authentication and authorization
type GenerateOption ¶ added in v2.1.0
type GenerateOption func(o *GenerateOptions)
type GenerateOptions ¶ added in v2.1.0
func NewGenerateOptions ¶ added in v2.1.0
func NewGenerateOptions(opts ...GenerateOption) GenerateOptions
NewGenerateOptions from a slice of options
type Option ¶ added in v2.1.0
type Option func(o *Options)
func PrivateKey ¶ added in v2.1.0
PrivateKey is the JWT private key
Click to show internal directories.
Click to hide internal directories.