Auth: Rotate token patch (#62676)

* Use singleflight.Group

* Align tests

* Cleanup
This commit is contained in:
Misi
2023-02-02 14:36:16 +01:00
committed by GitHub
parent 3c01ae2c9e
commit 7c1d9769ca
9 changed files with 122 additions and 88 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ type RevokeAuthTokenCmd struct {
type UserTokenService interface {
CreateToken(ctx context.Context, user *user.User, clientIP net.IP, userAgent string) (*UserToken, error)
LookupToken(ctx context.Context, unhashedToken string) (*UserToken, error)
TryRotateToken(ctx context.Context, token *UserToken, clientIP net.IP, userAgent string) (bool, error)
TryRotateToken(ctx context.Context, token *UserToken, clientIP net.IP, userAgent string) (bool, *UserToken, error)
RevokeToken(ctx context.Context, token *UserToken, soft bool) error
RevokeAllUserTokens(ctx context.Context, userId int64) error
GetUserToken(ctx context.Context, userId, userTokenId int64) (*UserToken, error)