cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [4/5] cxf-fediz git commit: Checkstyle fix
Date Thu, 21 Jan 2016 12:10:47 GMT
Checkstyle fix


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/f4828532
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/f4828532
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/f4828532

Branch: refs/heads/1.2.x-fixes
Commit: f4828532cb327427f68010cf2dc5b152c58aa1d8
Parents: dfc6a99
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Jan 21 11:56:24 2016 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Jan 21 12:10:22 2016 +0000

----------------------------------------------------------------------
 .../fediz/service/idp/beans/WfreshParser.java   | 26 ++++++++++++++------
 1 file changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/f4828532/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/WfreshParser.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/WfreshParser.java
b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/WfreshParser.java
index a428553..4478e52 100644
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/WfreshParser.java
+++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/WfreshParser.java
@@ -39,14 +39,7 @@ public class WfreshParser {
     public boolean authenticationRequired(String wfresh, String whr, RequestContext context)
         throws Exception {
         
-        SecurityToken idpToken = 
-            (SecurityToken) WebUtils.getAttributeFromExternalContext(context, whr);
-        if (idpToken == null) {
-            return true;
-        }
-        
-        if (tokenExpirationValidation && idpToken.isExpired()) {
-            LOG.info("[IDP_TOKEN=" + idpToken.getId() + "] is expired.");
+        if (checkIsIdpTokenExpired(whr, context)) {
             return true;
         }
 
@@ -68,6 +61,8 @@ public class WfreshParser {
         long ttlMs = ttl * 60L * 1000L;
         if (ttlMs > 0) {
 
+            SecurityToken idpToken = 
+                (SecurityToken) WebUtils.getAttributeFromExternalContext(context, whr);
             Date createdDate = idpToken.getCreated();
             if (createdDate != null) {
                 Date expiryDate = new Date();
@@ -87,6 +82,21 @@ public class WfreshParser {
         }
         return false;
     }
+    
+    private boolean checkIsIdpTokenExpired(String whr, RequestContext context) {
+        SecurityToken idpToken = 
+            (SecurityToken) WebUtils.getAttributeFromExternalContext(context, whr);
+        if (idpToken == null) {
+            return true;
+        }
+        
+        if (tokenExpirationValidation && idpToken.isExpired()) {
+            LOG.info("[IDP_TOKEN=" + idpToken.getId() + "] is expired.");
+            return true;
+        }
+
+        return false;
+    }
 
     public boolean isTokenExpirationValidation() {
         return tokenExpirationValidation;


Mime
View raw message