Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for private jwt client to rebuild when expired #221

Merged
merged 1 commit into from
May 5, 2020

Conversation

Budlee
Copy link
Contributor

@Budlee Budlee commented Apr 25, 2020

The PrivateJwt assertion with a certificate is generated once
This means that when a request for a new OAuth Token is made that
the client assertion has expired and fails. This change
fixes that by reubuilding the assersion for a private jwt when
it has expired

The PrivateJwt assertion with a certificate is generated once
This means that when a request for a new OAuth Token is made that
the client assertion has expired and fails. This change
fixes that by reubuilding the assersion for a private jwt when
it has expired
@msftclas
Copy link

msftclas commented Apr 25, 2020

CLA assistant check
All CLA requirements met.

Copy link
Contributor

@sangonzal sangonzal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Budlee Thanks for the contribution and cleaning up the code in a couple of places! looks good to me. @SomkaPe @Avery-Dunn thoughts?

final Date currentDateTime = new Date(System.currentTimeMillis());
final Date expirationTime = ((PrivateKeyJWT) clientAuthentication).getJWTAuthenticationClaimsSet().getExpirationTime();
if (expirationTime.before(currentDateTime)) {
//The asserted private jwt with the client certificate can expire so rebuild it when the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is missing a couple of words.

@@ -153,4 +164,70 @@ public void testAcquireToken_KeyCred() throws Exception {
PowerMock.verifyAll();
PowerMock.resetAll(app);
}

@Test
public void testClientCertificateRebuildsWhenExpired() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expiration is misspelled in a couple of places.

@SomkaPe SomkaPe merged commit f57d4dd into AzureAD:dev May 5, 2020
SomkaPe pushed a commit that referenced this pull request May 5, 2020
The PrivateJwt assertion with a certificate is generated once
This means that when a request for a new OAuth Token is made that
the client assertion has expired and fails. This change
fixes that by reubuilding the assersion for a private jwt when
it has expired
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants