Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RefreshToken ¶
type RefreshToken struct { ID string UserID string Token string Revoked bool CreatedAt time.Time UpdatedAt time.Time }
RefreshToken is the model for refresh tokens.
type RefreshTokenRepository ¶
type RefreshTokenRepository interface { // Save saves a given entity. Save(ctx context.Context, entity *RefreshToken) (*RefreshToken, error) // FindByToken retrieves an entity by its id. FindByID(ctx context.Context, id string) (*RefreshToken, error) // ExistsByID returns whether an entity with the given id exists. ExistsByID(ctx context.Context, id string) (bool, error) // FindAll returns all instances of the type. FindAll(ctx context.Context, afterCursor string, limit int) ([]*RefreshToken, string, error) // Count returns the number of entities available. Count(ctx context.Context) (int, error) // DeleteByID deletes the entity with the given id. DeleteByID(ctx context.Context, id string) error // Delete deletes a given entity. Delete(ctx context.Context, entity *RefreshToken) error // DeleteAll deletes all entities managed by the repository. DeleteAll(ctx context.Context) error // FindByToken retrieves an entity by token value. FindByToken(ctx context.Context, token string) (*RefreshToken, error) // FindAllForUser returns all refresh tokens for specified user ID. FindAllForUser(ctx context.Context, userID, afterCursor string, limit int) ([]*RefreshToken, string, error) }
type RefreshTokenUsecase ¶
type RefreshTokenUsecase interface { // GrantAuthenticatedUser creates a refresh token for the provided user. GrantAuthenticatedUser(context.Context, *user.User) (*RefreshToken, error) // GrantRefreshTokenSwap swaps a refresh token for a new one, revoking // the provided token. GrantRefreshTokenSwap(context.Context, *user.User, *RefreshToken) (*RefreshToken, error) // FindRefreshTokenByID retrieves an refresh token by ID. FindRefreshTokenByID(context.Context, string) (*RefreshToken, error) // FindRefreshTokenByToken retrieves an refresh token by token value. FindRefreshTokenByToken(context.Context, string) (*RefreshToken, error) // Revoke revokes the provided token. Revoke(context.Context, *RefreshToken) error // Logout deletes all refresh tokens for a user. Logout(context.Context, *user.User) error }
Click to show internal directories.
Click to hide internal directories.