Documentation
¶
Index ¶
- Variables
- func ComparePassword(hashedPassword, plainPassword string) error
- func ExtractToken(tokenString, subject string, claims *Claims) (*jwt.Token, error)
- func GenerateLoginResponse(id, username string, accessLevel int) (*LoginResponse, *Token, error)
- func GeneratePassword(password string) (string, error)
- func RandomAlphaNum(length int) string
- func RandomAlphapet(length int) string
- func RandomInt(min, max int64) int64
- func ValidateToken(token *jwt.Token, claims *Claims, subject string) error
- type Claims
- type LoginResponse
- type Token
- type TokenDetail
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ComparePassword ¶
ComparePassword compares the password with the hash password
func ExtractToken ¶
func GenerateLoginResponse ¶
func GenerateLoginResponse(id, username string, accessLevel int) (*LoginResponse, *Token, error)
func GeneratePassword ¶
creates and returns a hash of the give password string
func RandomAlphaNum ¶
func RandomAlphapet ¶
func ValidateToken ¶
Types ¶
type LoginResponse ¶
type Token ¶
type Token struct { AccessToken *TokenDetail RefreshToken *TokenDetail }
type TokenDetail ¶
type TokenDetail struct { UserID string Username string AccessLevel int Token *string TokenID string ExpiresAt time.Time Subject string }
func GenerateAccessToken ¶
func GenerateAccessToken(id, username, tokenID string, accessLevel int) (*TokenDetail, error)
func GenerateRefreshToken ¶
func GenerateRefreshToken(id, username, tokenID string, accessLevel int) (*TokenDetail, error)
func VerifyTokenWithClaims ¶
func VerifyTokenWithClaims(tokenString, subject string) (*TokenDetail, error)
Click to show internal directories.
Click to hide internal directories.