models

package
v0.25.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	Name            string
	Email           string
	Username        string
	Roles           []string
	Scopes          []string
	IsAuthenticated bool
	IsAdmin         bool
	OAuth2Token     *oauth2.Token
	JWTToken        *jwt.Token
}

func UserFromJWTToken

func UserFromJWTToken(token *jwt.Token, clientID string) (User, error)

UserFromJWTToken builds a user model from the claims of a JWT token clientID is used to find the client from the resource_access claim where the roles are found

func (User) HasRole

func (u User) HasRole(role string) bool

func (User) HasRolesAnd

func (u User) HasRolesAnd(roles []string) bool

func (User) HasRolesOr

func (u User) HasRolesOr(roles []string) bool

func (User) Validate

func (u User) Validate() (errs []error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL