domain

package
v0.0.0-...-5142fe7 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2021 License: MIT Imports: 8 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, *errors.AppError)
}

type AuthRepositoryDb

type AuthRepositoryDb struct {
	// contains filtered or unexported fields
}

func NewAuthRepositoryDb

func NewAuthRepositoryDb(client *sqlx.DB) AuthRepositoryDb

func (AuthRepositoryDb) FindBy

func (repo AuthRepositoryDb) FindBy(username string, password string) (*Login, *errors.AppError)

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"`
	jwt.StandardClaims
}

func (Claims) IsRequestVerifiedWithTokenClaims

func (c Claims) IsRequestVerifiedWithTokenClaims(urlParams map[string]string) bool

func (Claims) IsUserRole

func (c Claims) IsUserRole() bool

type Login

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

func (Login) GenerateToken

func (l Login) GenerateToken() (*string, *errors.AppError)

type RolePermissions

type RolePermissions struct {
	// contains filtered or unexported fields
}

func GetRolePermissions

func GetRolePermissions() RolePermissions

func (RolePermissions) IsAuthorizedFor

func (p RolePermissions) IsAuthorizedFor(role string, routeName string) bool

Jump to

Keyboard shortcuts

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