Documentation ¶
Index ¶
- 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 HashAndSalt(pwd string) (string, error)
- func IsSamePassword(plainPwd string, hashedPwd string) bool
- func Setup(ck *CertAndKeys)
- type CertAndKeys
- type VerifyUserResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 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
type VerifyUserResult ¶ added in v0.1.56
type VerifyUserResult int
VerifyUserResult type with enum
const ( // VerifyUserResultOK found username and password VerifyUserResultOK VerifyUserResult = iota // VerifyUserResultPasswordNotMatch password does not match VerifyUserResultPasswordNotMatch // VerifyUserResultEmailNotFound email is not found VerifyUserResultEmailNotFound // VerifyUserResultOtherError other error VerifyUserResultOtherError )
func GetVerifiedAuthUser ¶ added in v0.1.36
func GetVerifiedAuthUser(userModel models.IModel) (models.IModel, VerifyUserResult)
GetVerifiedAuthUser authenticates the user
Click to show internal directories.
Click to hide internal directories.