token

package
v0.64.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRepository

func NewRepository(redisClient *redis.Client) *redisTokenRepository

Types

type RefreshTokenData

type RefreshTokenData struct {
	SignedToken string
	ID          uuid.UUID
	UserId      uint
}

type TokenService added in v0.64.0

type TokenService struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(
	logger *slog.Logger,
	tokenRepository repository,
	privateKey *rsa.PrivateKey,
	accessTokenExpirationSeconds int,
	refreshTokenSecretKey string,
	refreshTokenExpirationSeconds int,
	refreshTokenRememberMeExpirationSeconds int,
) (*TokenService, error)

func (TokenService) GetTokens added in v0.64.0

func (t TokenService) GetTokens(user *model.User, previousRefreshTokenId string, rememberMe bool) (*Tokens, error)

func (TokenService) RefreshAccessToken added in v0.64.0

func (t TokenService) RefreshAccessToken(accessToken string) (string, error)

func (TokenService) SignOut added in v0.64.0

func (t TokenService) SignOut(userId uint) error

func (TokenService) ValidateRefreshToken added in v0.64.0

func (t TokenService) ValidateRefreshToken(ctx context.Context, tokenString string) (*RefreshTokenData, error)

type Tokens

type Tokens struct {
	AccessToken  string `json:"accessToken"`
	TokenType    string `json:"tokenType"`
	RefreshToken string `json:"refreshToken"`
	ExpiresIn    uint   `json:"expiresIn"`
}

Tokens domain object defining user tokens swagger:model

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL