mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-20 13:30:46 +02:00
test: revert test-only IsExpired helpers; restore direct expiration assertions
Remove session_helpers.go and update TestSTSSessionClaimsToSessionInfoCredentialExpiration to assert against sessionInfo.Credentials.Expiration directly as requested by reviewer.,
This commit is contained in:
@@ -179,13 +179,11 @@ func TestSTSSessionClaimsToSessionInfoCredentialExpiration(t *testing.T) {
|
||||
assert.True(t, sessionInfo.Credentials.Expiration.Sub(tc.expiresAt) < time.Second)
|
||||
|
||||
// We set tc.expiresAt to past/future values to exercise expiration handling.
|
||||
// Use helper methods to assert expiration behavior on both SessionInfo and Credentials.
|
||||
// Assert the credentials' expiration relative to now to exercise code behavior
|
||||
if tc.expectNotExpired {
|
||||
assert.False(t, sessionInfo.IsExpired(), tc.description)
|
||||
assert.False(t, sessionInfo.Credentials.IsExpired(), tc.description)
|
||||
assert.True(t, time.Now().Before(sessionInfo.Credentials.Expiration), tc.description)
|
||||
} else {
|
||||
assert.True(t, sessionInfo.IsExpired(), tc.description)
|
||||
assert.True(t, sessionInfo.Credentials.IsExpired(), tc.description)
|
||||
assert.True(t, time.Now().After(sessionInfo.Credentials.Expiration), tc.description)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ func (iam *IdentityAccessManagement) validateSTSSessionToken(r *http.Request, se
|
||||
PrincipalArn: sessionInfo.Principal,
|
||||
}
|
||||
|
||||
glog.V(2).Infof("Successfully validated STS session token for principal: %s, assumed role user: %s",
|
||||
glog.V(2).Infof("Successfully validated STS session token for principal: %s, assumed role user: %s",
|
||||
sessionInfo.Principal, sessionInfo.AssumedRoleUser)
|
||||
return identity, cred, s3err.ErrNone
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user