Documentation ¶
Index ¶
Constants ¶
View Source
const ( RoleAdmin = "ADMIN" RoleUser = "USER" )
These are the expected values for Claims.Roles.
View Source
const Key ctxKey = 1
Key is used to store/retrieve a Claims value from a context.Context.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct { Roles []string `json:"roles"` jwt.StandardClaims }
Claims represents the authorization claims transmitted via a JWT.
func NewClaims ¶
NewClaims constructs a Claims value for the identified user. The Claims expire within a specified duration of the provided time. Additional fields of the Claims can be set after calling NewClaims is desired.
Click to show internal directories.
Click to hide internal directories.