@@ -427,8 +427,8 @@ func TestAuthorizationStore_HashingConfigChanges(t *testing.T) {
427
427
},
428
428
429
429
// The following tests are artificial tests intended to check proper operation when both
430
- // Token and HashedToken is set on an update. This should not occur in normal operation because,
431
- // we do not alter tokens like this. However, this is nothing to prevent this so we want to make sure
430
+ // Token and HashedToken are set on an update. This should not occur in normal operation because,
431
+ // we do not alter tokens like this. However, there is nothing to prevent this so we want to make sure
432
432
// it works properly.
433
433
{
434
434
desc : "set Token and HashedToken with hashing enabled" ,
@@ -485,41 +485,6 @@ func TestAuthorizationStore_HashingConfigChanges(t *testing.T) {
485
485
},
486
486
hashedTokens : []string {},
487
487
},
488
- /*
489
- {
490
- desc: "set Token and HashedToken with hashing re-enabled",
491
- config: testConfig{enabled: true, algo: influxdb2_algo.VariantIdentifierSHA256},
492
- action: func(t *testing.T, ctx context.Context, store *authorization.Store, tx kv.Tx) {
493
- for i := 1; i <= 3; i++ {
494
- token := fmt.Sprintf("Token#%d", i)
495
- auth, err := store.GetAuthorizationByToken(ctx, tx, token)
496
- require.NoError(t, err)
497
- require.Equal(t, auth.Token, token)
498
- require.Empty(t, auth.HashedToken, "only Token should be set from the last test case")
499
-
500
- // Set Token and update.
501
- tokenDigest, err := sha256.Hash(token)
502
- require.NoError(t, err)
503
- hashedToken := tokenDigest.Encode()
504
- auth.HashedToken = hashedToken
505
- newAuth, err := store.UpdateAuthorization(ctx, tx, platform.ID(i), auth)
506
- require.NoError(t, err)
507
-
508
- // Both newAuth.Token and newAuth.HashedToken should still be set, but only
509
- // HashedToken should be stored and indexed.
510
- require.Equal(t, token, newAuth.Token)
511
- require.Equal(t, hashedToken, newAuth.HashedToken)
512
- }
513
- },
514
- // NOTE: All hashes should be updated to the currently configured algorithm.
515
- exp: []authData{
516
- {ID: platform.ID(1), HashedToken: sha256.MustHash("Token#1").Encode()},
517
- {ID: platform.ID(2), HashedToken: sha256.MustHash("Token#2").Encode()},
518
- {ID: platform.ID(3), HashedToken: sha256.MustHash("Token#3").Encode()},
519
- },
520
- hashedTokens: []string{"Token#1", "Token#2", "Token#3"},
521
- },
522
- */
523
488
}
524
489
525
490
ctx := context .Background ()
0 commit comments