-
Notifications
You must be signed in to change notification settings - Fork 147
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
Conversation
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
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
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