Merge "Correct format for token expiration time"

This commit is contained in:
Zuul 2024-09-03 05:29:30 +00:00 committed by Gerrit Code Review
commit 7ecd4ca287
2 changed files with 5 additions and 2 deletions

View File

@ -6398,6 +6398,7 @@ class ApplicationCredentialAuth(test_v3.RestfulTestCase):
resp = self.v3_create_token(
auth_data, expected_status=http.client.CREATED
)
self.assertValidTokenResponse(resp)
token = resp.headers.get('X-Subject-Token')
future = timeutils.utcnow() + datetime.timedelta(minutes=2)
with freezegun.freeze_time(future):

View File

@ -315,11 +315,13 @@ class Manager(manager.Manager):
if (app_cred['expires_at'] is not None) and (
token_time > app_cred['expires_at']
):
token.expires_at = app_cred['expires_at'].isoformat()
token.expires_at = utils.isotime(
app_cred['expires_at'], subsecond=True
)
LOG.debug(
'Resetting token expiration to the application'
' credential expiration: %s',
app_cred['expires_at'].isoformat(),
token.expires_at,
)
token_id, issued_at = self.driver.generate_id_and_issued_at(token)