internalauth

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableTwoFactor

func DisableTwoFactor(db *gorm.DB, u hide.ID, password string) (bool, error)

func EnableTwoFactor

func EnableTwoFactor(db *gorm.DB, u hide.ID, secret string, token string) ([]string, error)

EnableTwoFactor will enable 2FA for the user passed to it if the token validates against the secret

func GetBackupKeys

func GetBackupKeys(db *gorm.DB, authCtx auth.Context) ([]string, error)

func GetTwoFactor

func GetTwoFactor(db *gorm.DB, u hide.ID) (*model.TwoFactor, error)

func HashPassword

func HashPassword(password string) (string, error)

HashPassword attempts to hash the supplied password

func IsTwoFactorEnabled

func IsTwoFactorEnabled(db *gorm.DB, u hide.ID) (bool, error)

func LoginUser

func LoginUser(user *model.User, permissions []*permission.Permission, cfg *config.JWTConfig) (string, error)

LoginUser generates a signed JWT token

func LoginUserSecure

func LoginUserSecure(user *model.User, permissions []*permission.Permission, cfg *config.JWTConfig) (string, error)

func VerifyPassword

func VerifyPassword(db *gorm.DB, userID hide.ID, password string) bool

VerifyPassword verifies a password against the stored hash

func VerifyTwoFactor

func VerifyTwoFactor(t *model.TwoFactor, token string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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