Documentation ¶
Index ¶
- Constants
- func CreateAccessToken(user *domain.User, secret string, expiry int, ...) (accessToken string, err error)
- func CreateForgotToken(user *domain.User, expiry int, ...) (forgotToken string, err error)
- func CreateRefreshToken(user *domain.User, secret string, expiry int, accessToken string, ...) (refreshToken string, err error)
- func ExtractDataFromToken(requestToken string, secret string, tokenType string, ...) (domain.TokenData, error)
- func ExtractIDFromToken(requestToken string, secret string, tokenType string, ...) (userId string, userRole string, err error)
- func IsAuthorized(requestToken string, secret string) (bool, error)
- func IsExistTokenInDB(tokenData string, tokenType string, ...) bool
- func ParseJWTToken(requestToken string, secret string) (jwt.MapClaims, error)
- func RevokeAll(accessToken string, secret string, ...) error
- func RevokeToken(accessToken string, secret string, ...) error
Constants ¶
View Source
const ( ErrorNotFoundInRedis = "invalid token (not found in redis)" ErrorInvalidToken = "invalid token" RefreshToken = "refresh_token" AccessToken = "access_token" VerificationEmail = "verification_email" ForgotPassword = "forgot_password" AnonymousRole = "anonymous" )
Variables ¶
This section is empty.
Functions ¶
func CreateAccessToken ¶
func CreateForgotToken ¶
func CreateRefreshToken ¶
func ExtractDataFromToken ¶
func ExtractDataFromToken(requestToken string, secret string, tokenType string, accessTokenUsecase domain.AccessTokenUsecase, refreshTokenUsecase domain.RefreshTokenUsecase) (domain.TokenData, error)
func ExtractIDFromToken ¶
func ExtractIDFromToken(requestToken string, secret string, tokenType string, accessTokenUsecase domain.AccessTokenUsecase, refreshTokenUsecase domain.RefreshTokenUsecase) (userId string, userRole string, err error)
func IsExistTokenInDB ¶
func IsExistTokenInDB(tokenData string, tokenType string, accessTokenUsecase domain.AccessTokenUsecase, refreshTokenUsecase domain.RefreshTokenUsecase) bool
func RevokeAll ¶
func RevokeAll(accessToken string, secret string, accessTokenUsecase domain.AccessTokenUsecase, refreshTokenUsecase domain.RefreshTokenUsecase) error
func RevokeToken ¶
func RevokeToken(accessToken string, secret string, accessTokenUsecase domain.AccessTokenUsecase, refreshTokenUsecase domain.RefreshTokenUsecase) error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.