This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch 1.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git


The following commit(s) were added to refs/heads/1.4.x-fixes by this push:
     new 259747e  fediz-oidc: fix exp claim when timeToLive specified
259747e is described below

commit 259747e1a94a52b91fd2ab6ff0760d1b3f872f75
Author: Alexey Markevich <[email protected]>
AuthorDate: Wed Feb 26 14:10:13 2020 +0300

    fediz-oidc: fix exp claim when timeToLive specified
---
 .../org/apache/cxf/fediz/service/oidc/FedizSubjectCreator.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizSubjectCreator.java
 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizSubjectCreator.java
index 3a9e6e5..9488a0f 100644
--- 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizSubjectCreator.java
+++ 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizSubjectCreator.java
@@ -137,15 +137,15 @@ public class FedizSubjectCreator implements 
SubjectCreator {
         idToken.setTokenId(OAuthUtils.generateRandomTokenKey());
 
         // Compute exp claim
-        long currentTimeInSecs = System.currentTimeMillis() / 1000L;
-        idToken.setIssuedAt(currentTimeInSecs);
+        final long iat = OAuthUtils.getIssuedAt();
+        idToken.setIssuedAt(iat);
         HttpSession httpSession = mc.getHttpServletRequest().getSession(false);
         if (timeToLive > 0) {
-            idToken.setExpiryTime(timeToLive);
+            idToken.setExpiryTime(iat + timeToLive);
         } else if (httpSession != null && httpSession.getMaxInactiveInterval() 
> 0) {
-            idToken.setExpiryTime(currentTimeInSecs + 
httpSession.getMaxInactiveInterval());
+            idToken.setExpiryTime(iat + httpSession.getMaxInactiveInterval());
         } else {
-            idToken.setExpiryTime(currentTimeInSecs + DEFAULT_TIME_TO_LIVE);
+            idToken.setExpiryTime(iat + DEFAULT_TIME_TO_LIVE);
         }
 
         List<String> requestedClaimsList = new ArrayList<String>();

Reply via email to