authmodels

package
v0.0.0-...-10bc8b7 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AccountTypeAdmin define account type ADMIN
	AccountTypeAdmin = AccountType("ADMIN")

	// AccountTypeDevice define account type DEVICE
	AccountTypeDevice = AccountType("DEVICE")

	// AccountTypeOrg define account type ORG
	AccountTypeOrg = AccountType("ORG")

	// AccountTypeService define account type SERVICE
	AccountTypeService = AccountType("SERVICE")

	// AccountTypeUser define account type USER
	AccountTypeUser = AccountType("USER")

	// AccountTypeSessionUser define account type SESSION
	AccountTypeSessionUser = AccountType("SESSION")

	// AccountTypeClient define account type CLIENT
	AccountTypeClient = AccountType("CLIENT")

	// AccountTypeService define account type SERVICE
	AccountTypeResource = AccountType("RESOURCE")

	// RoleTypeUser role for users
	RoleTypeUser = RolesType("user")

	// RoleTypeService role for services
	RoleTypeService = RolesType("service")

	// RoleTypeResource role for resources
	RoleTypeResource = RolesType("resource")

	// RoleTypeAdmin role for admin actions
	RoleTypeAdmin = RolesType("admin")
)
View Source
const AccountServicePrn = "accounts"
View Source
const TokenServicePrn = "tokens"

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	helpermodels.Timestamp      `json:",inline" bson:",inline"`
	helpermodels.Identification `json:",inline" bson:",inline"`
	helpermodels.Ownership      `json:"-" bson:"-"`

	Email    string      `json:"email" bson:"email"`
	Nick     string      `json:"username" bson:"nick"`
	Password string      `json:"password" bson:"password"`
	Type     AccountType `json:"type" bson:"type"`
	Role     RolesType   `json:"role" bson:"role"`
}

Account account information all the structure

func NewAccount

func NewAccount() *Account

NewAccount create new account struct

func (*Account) GetServicePrn

func (acc *Account) GetServicePrn() string

type AccountToken

type AccountToken struct {
	jwt.StandardClaims `json:",inline" bson:",inline"`

	ID     string      `json:"id"`
	Nick   string      `json:"nick"`
	Scopes string      `json:"scopes"`
	Prn    prnx.Prn    `json:"prn"`
	Roles  RolesType   `json:"roles"`
	Type   AccountType `json:"type"`
}

AccountToken Token payload

type AccountType

type AccountType string

AccountType Type of account

type RolesType

type RolesType string

RolesType type of roles

type Token

type Token struct {
	helpermodels.Identificable `json:",inline" bson:",inline"`
	helpermodels.Timestamp     `json:",inline" bson:",inline"`
	helpermodels.Ownership     `json:",inline" bson:",inline"`

	ExpiresAt *time.Time  `json:"expires_at" bson:"expires_at"`
	Nick      string      `json:"nick" bson:"nick"`
	Scopes    string      `json:"scopes" bson:"scopes"`
	Roles     RolesType   `json:"roles" bson:"roles"`
	Type      AccountType `json:"type" bson:"type"`
	Raw       string      `json:"token" bson:"raw"`
}

Token database token

func (*Token) GetServicePrn

func (t *Token) GetServicePrn() string

type TokenPayload

type TokenPayload struct {
	Token     string `json:"token"`
	TokenType string `json:"token_type,omitempty"`
	Scopes    string `json:"scopes,omitempty"`
}

TokenPayload login token payload

Jump to

Keyboard shortcuts

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