Skip to content

Fix for private jwt client to rebuild when expired#221

Merged
SomkaPe merged 1 commit intoAzureAD:devfrom
Budlee:private-jwt-fix
May 5, 2020
Merged

Fix for private jwt client to rebuild when expired#221
SomkaPe merged 1 commit intoAzureAD:devfrom
Budlee:private-jwt-fix

Conversation

@Budlee
Copy link
Copy Markdown
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
Copy Markdown

msftclas commented Apr 25, 2020

CLA assistant check
All CLA requirements met.

Copy link
Copy Markdown
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
Copy Markdown
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.

}

@Test
public void testClientCertificateRebuildsWhenExpired() throws Exception {
Copy link
Copy Markdown
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