-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: enhancementA general enhancementA general enhancement
Milestone
Description
Describe the bug
OAuth2AccessTokenResponse doesn't use values provided to expiresIn()
method when it was originally built from a previous response (through the withResponse()
method).
Expected behavior
The newly created token response should update expiresAt
using the value the provided to expiresIn()
, or maybe throw an exception if keeping the original expiresAt
value is done on purpose.
Sample
@Test
public void test() {
var sourceTokenResponse = OAuth2AccessTokenResponse.withToken("abcd")
.tokenType(OAuth2AccessToken.TokenType.BEARER)
.expiresIn(10)
.build();
var modifiedTokenResponse = OAuth2AccessTokenResponse
.withResponse(sourceTokenResponse)
.expiresIn(60)
.build();
Assertions.assertEquals(
modifiedTokenResponse.getAccessToken().getIssuedAt().plusSeconds(60),
modifiedTokenResponse.getAccessToken().getExpiresAt());
}
Note
May be linked to #8696 ?
Metadata
Metadata
Assignees
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: enhancementA general enhancementA general enhancement