Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithUser(ctx context.Context, claims Claims) context.Context
- func CreateToken(claims Claims) (string, error)
- func HasRole(roles []string, wanted string) bool
- func RolesFromContext(ctx context.Context) ([]string, bool)
- func UserFromContext(ctx context.Context) (string, bool)
- type Claims
Constants ¶
View Source
const ( RoleAdmin = "ADMIN" RoleAuthor = "AUTHOR" )
Variables ¶
View Source
var ErrInvalidToken = errors.New("Invalid token")
Functions ¶
func CreateToken ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.