Rename refresh token errors to list error (#4138)
This commit is contained in:
1 parent
a1bc2be136
commit
2d18f82c9f
9 files changed
+21
-21
No files matched your search
+1
-1
@@ -66,7 +66,7 @@ func testFullFetchRetrievalFunc[T any](t *testing.T, ret []T) func(context.Conte
|
||||
func testErroringForRefreshTokenRetrievalFunc[T any](t *testing.T, ret []T) func(context.Context, string, string, RefreshTokenValue) ([]T, []string, RefreshTokenValue, error) {
|
||||
return func(ctx context.Context, s1, s2 string, refToken RefreshTokenValue) ([]T, []string, RefreshTokenValue, error) {
|
||||
if refToken != "" {
|
||||
return nil, nil, "", api.ErrInvalidRefreshToken
|
||||
return nil, nil, "", api.ErrInvalidListToken
|
||||
}
|
||||
return ret, nil, "1", nil
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ func defaultSessionFunc(ctx context.Context, addr, authTok string, refreshTok Re
|
||||
sClient := sessions.NewClient(client)
|
||||
l, err := sClient.List(ctx, "global", sessions.WithIncludeTerminated(true), sessions.WithRecursive(true), sessions.WithListToken(string(refreshTok)))
|
||||
if err != nil {
|
||||
if api.ErrInvalidRefreshToken.Is(err) {
|
||||
if api.ErrInvalidListToken.Is(err) {
|
||||
return nil, nil, "", err
|
||||
}
|
||||
return nil, nil, "", errors.Wrap(ctx, err, op)
|
||||
@@ -82,7 +82,7 @@ func (r *Repository) refreshSessions(ctx context.Context, u *user, tokens map[Au
|
||||
var retErr error
|
||||
for at, t := range tokens {
|
||||
resp, removedIds, newRefreshToken, err = opts.withSessionRetrievalFunc(ctx, u.Address, t, oldRefreshTokenVal)
|
||||
if api.ErrInvalidRefreshToken.Is(err) {
|
||||
if api.ErrInvalidListToken.Is(err) {
|
||||
if err := r.deleteRefreshToken(ctx, u, resourceType); err != nil {
|
||||
return errors.Wrap(ctx, err, op)
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ func defaultTargetFunc(ctx context.Context, addr, authTok string, refreshTok Ref
|
||||
tarClient := targets.NewClient(client)
|
||||
l, err := tarClient.List(ctx, "global", targets.WithRecursive(true), targets.WithListToken(string(refreshTok)))
|
||||
if err != nil {
|
||||
if api.ErrInvalidRefreshToken.Is(err) {
|
||||
if api.ErrInvalidListToken.Is(err) {
|
||||
return nil, nil, "", err
|
||||
}
|
||||
return nil, nil, "", errors.Wrap(ctx, err, op)
|
||||
@@ -81,7 +81,7 @@ func (r *Repository) refreshTargets(ctx context.Context, u *user, tokens map[Aut
|
||||
var retErr error
|
||||
for at, t := range tokens {
|
||||
resp, removedIds, newRefreshTokenVal, err = opts.withTargetRetrievalFunc(ctx, u.Address, t, oldRefreshTokenVal)
|
||||
if api.ErrInvalidRefreshToken.Is(err) {
|
||||
if api.ErrInvalidListToken.Is(err) {
|
||||
if err := r.deleteRefreshToken(ctx, u, resourceType); err != nil {
|
||||
return errors.Wrap(ctx, err, op)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user