auth

package
Version: v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAccessToken

func GenerateAccessToken() string

Total: (SHA-256 of nano secs = 256 bits) + (32 random bytes) = 64 bytes

func GenerateOTPCode

func GenerateOTPCode(length int) int

func GeneratePassword

func GeneratePassword(length int) string

Generate a random password with a specific length. It returns an empty string if there is any error.

func GetFirebaseUser

func GetFirebaseUser(accessToken string) (*firebase.UserRecord, error)

func GetSHA256

func GetSHA256(value string) string

Returns SHA256 of a string

func HasPermission

func HasPermission(c echo.Context, subject string) bool

HasPermission return true if a subject has permission on a request

func InitCasbin

func InitCasbin(config CasbinConfig) error

InitCasbin creates an enforcer via file. See `casbin.NewEnforcer` for more info.

Types

type CasbinConfig

type CasbinConfig struct {
	Model  string `yaml:"model"`
	Policy string `yaml:"policy"`
}

Jump to

Keyboard shortcuts

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