Documentation ¶
Index ¶
- Variables
- func CreateAccessToken(ident *datatypes.UUID, duration time.Duration, scope *string) (string, error)
- func CreateRefreshToken(ident *datatypes.UUID, duration time.Duration, scope *string) (string, error)
- func GetClaimsIfAccessTokenIsValid(tokenString string) (*jwt.MapClaims, error)
- func GetClaimsIfRefreshTokenIsValid(tokenString string) (*jwt.MapClaims, error)
- func GetVerifiedAuthUser(db *gorm.DB, userModel models.IModel) (models.IModel, error)
- func HashAndSalt(pwd string) (string, error)
- func IsSamePassword(plainPwd string, hashedPwd string) bool
- func Setup(ck *CertAndKeys)
- type CertAndKeys
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmailNotFound = errors.New("email not found")
View Source
var ErrInactive = errors.New("account inactive")
View Source
var ErrNotVerified = errors.New("email not verified")
View Source
var ErrPasswordIncorrect = errors.New("password incorrect")
Functions ¶
func CreateAccessToken ¶
func CreateAccessToken(ident *datatypes.UUID, duration time.Duration, scope *string) (string, error)
CreateAccessToken creates a new JWT token
func CreateRefreshToken ¶
func CreateRefreshToken(ident *datatypes.UUID, duration time.Duration, scope *string) (string, error)
CreateRefreshToken creates a new JWT token
func GetClaimsIfAccessTokenIsValid ¶
GetClaimsIfAccessTokenIsValid validates this token and get the ISS claim
func GetClaimsIfRefreshTokenIsValid ¶
GetClaimsIfRefreshTokenIsValid validates this token and get the ISS claim
func GetVerifiedAuthUser ¶ added in v0.1.36
GetVerifiedAuthUser authenticates the user userModel is from JSON in the HTTP body
func HashAndSalt ¶
HashAndSalt turns password into encrypted hash The salt is included in the hash
func IsSamePassword ¶
IsSamePassword checks if password is the same as in the db
func Setup ¶ added in v0.1.44
func Setup(ck *CertAndKeys)
Setup loads the public and private keys fromfile
Types ¶
type CertAndKeys ¶ added in v0.1.44
type CertAndKeys struct { /* Access tokens */ AccessTokenPrivKeyPath string AccessTokenPubKeyPath string AccessTokenPemPasswd string /* Refresh tokens */ RefreshTokenPrivKeyPath string RefreshTokenPubKeyPath string RefreshTokenPemPasswd string }
CertAndKeys are paths for certificates and keys for initialization
Click to show internal directories.
Click to hide internal directories.