domain

package
v0.0.0-...-17fda26 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const HMAC_SAMPLE_SECRET = "hmacSampleSecret"
View Source
const TOKEN_DURATION = time.Hour

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRepository

type AuthRepository interface {
	FindBy(string, string) (*Login, error)
}

type Claims

type Claims struct {
	CustomerId string   `json:"customer_id"`
	Accounts   []string `json:"accounts"`
	Username   string   `json:"username"`
	Expiry     int64    `json:"exp"`
	Role       string   `json:"role"`
}

func BuildClaimsFromJwtMapClaims

func BuildClaimsFromJwtMapClaims(mapClaims jwt.MapClaims) (*Claims, error)

func (Claims) IsUserRole

func (c Claims) IsUserRole() bool

type Login

type Login struct {
	Username   string         `db:"username"`
	CustomerId sql.NullString `db:"customer_id"`
	Role       string         `db:"role"`
	Accounts   sql.NullString `db:"account_numbers"`
}

func (Login) GenerateToken

func (l Login) GenerateToken() (*string, error)

Jump to

Keyboard shortcuts

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