Documentation ¶
Index ¶
- func NewClientJWT(secret string, client authdb.ClientModel) string
- func NewUserJWT(secret string, user authdb.UserModel) string
- func ValidateEmail(email string) bool
- func ValidatePassword(password string) error
- func ValidateRedirectURI(uri string) bool
- func ValidateScope(resType string, scope []string) bool
- func VerifyPassword(hash, password string) bool
- type Claims
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClientJWT ¶
func NewClientJWT(secret string, client authdb.ClientModel) string
NewClientJWT creates a jwt token string for the given client, with the given secret string. Returns empty string on error.
func NewUserJWT ¶
NewUserJWT creates a jwt token string for the given user, with the given secret string. Returns empty string on error.
func ValidateEmail ¶
ValidateEmail checks whether email is a valid email address.
func ValidatePassword ¶
ValidatePassword checks whether password is strong enough.
func ValidateRedirectURI ¶
ValidateRedirectURI validates a client redirect URI.
func ValidateScope ¶
ValidateScope checks whether the scope string is valid for the given response type.
func VerifyPassword ¶
VerifyPassword verifies that a given password matches the hash.
Types ¶
type Claims ¶
type Claims struct { Sub string `json:"sub"` Type string `json:"type"` PKey string `json:"pkey"` Iss string `json:"iss"` Aud string `json:"aud"` Exp int64 `json:"exp"` }
Claims are the JWT claims.
func ValidateJWT ¶
ValidateJWT checks if the JWT string literal is valid. It does not check if the user password has been changed.