Documentation ¶
Index ¶
- func GetTokenByID(tokenID string, r models.TokenRepositoryInterface) (*models.Token, error)
- func NewAccessToken(claims UserClaims, secret string) (string, error)
- func NewRefreshToken(claims jwt.StandardClaims, secret string) (string, error)
- func NewToken(user *models.User, r models.TokenRepositoryInterface) ([]string, error)
- func NewTokenRepository(cache db.Cacher) models.TokenRepositoryInterface
- func NewTokenService(tokenRepository models.TokenRepositoryInterface) models.TokenServiceInterface
- func ParseRefreshToken(refreshToken string, secret string) *jwt.StandardClaims
- type TokenRepository
- type TokenService
- type UserClaims
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTokenByID ¶
GetTokenByID is a static function to export to other services.
func NewAccessToken ¶
func NewAccessToken(claims UserClaims, secret string) (string, error)
NewAccessToken generates a new signed access token.
func NewRefreshToken ¶
func NewRefreshToken(claims jwt.StandardClaims, secret string) (string, error)
NewRefreshToken generates a new signed refresh token.
func NewTokenRepository ¶
func NewTokenRepository(cache db.Cacher) models.TokenRepositoryInterface
func NewTokenService ¶
func NewTokenService(tokenRepository models.TokenRepositoryInterface) models.TokenServiceInterface
func ParseRefreshToken ¶
func ParseRefreshToken(refreshToken string, secret string) *jwt.StandardClaims
ParseRefreshToken decodes the refreshCookie value to get the StandardClaims payload.
Types ¶
type TokenRepository ¶
type TokenRepository struct {
// contains filtered or unexported fields
}
The implementation of pkg/models.TokenRepositoryInterface.
func (*TokenRepository) Delete ¶
func (r *TokenRepository) Delete(tokenID string) error
type TokenService ¶
type TokenService struct {
// contains filtered or unexported fields
}
type UserClaims ¶
type UserClaims struct { Nickname string `json:"nickname"` jwt.StandardClaims }
UserClaims is a generic structure for a personal user's (access) token.
func ParseAccessToken ¶
func ParseAccessToken(accessToken string, secret string) *UserClaims
ParseAccessToken decodes the accessCookie value to get the UserClaims payload.
Click to show internal directories.
Click to hide internal directories.