cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject svn commit: r1350380 - in /cxf/fediz/trunk: ./ plugins/core/ plugins/core/src/main/java/org/apache/cxf/fediz/core/FederationProcessorImpl.java plugins/tomcat/
Date Thu, 14 Jun 2012 19:57:05 GMT
Author: owulff
Date: Thu Jun 14 19:57:05 2012
New Revision: 1350380

URL: http://svn.apache.org/viewvc?rev=1350380&view=rev
Log:
wct Parameter support and Lifetime element validation in RSTR

Modified:
    cxf/fediz/trunk/   (props changed)
    cxf/fediz/trunk/plugins/core/   (props changed)
    cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/FederationProcessorImpl.java
    cxf/fediz/trunk/plugins/tomcat/   (props changed)

Propchange: cxf/fediz/trunk/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jun 14 19:57:05 2012
@@ -0,0 +1,7 @@
+target
+.classpath
+.pmd
+.settings
+.ruleset
+.project
+.checkstyle

Propchange: cxf/fediz/trunk/plugins/core/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jun 14 19:57:05 2012
@@ -0,0 +1,7 @@
+target
+.classpath
+.pmd
+.settings
+.ruleset
+.project
+.checkstyle

Modified: cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/FederationProcessorImpl.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/FederationProcessorImpl.java?rev=1350380&r1=1350379&r2=1350380&view=diff
==============================================================================
--- cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/FederationProcessorImpl.java
(original)
+++ cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/FederationProcessorImpl.java
Thu Jun 14 19:57:05 2012
@@ -45,6 +45,7 @@ import org.apache.cxf.fediz.core.spi.WAu
 import org.apache.cxf.fediz.core.util.DOMUtils;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.util.XmlSchemaDateFormat;
+import org.joda.time.DateTime;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -141,11 +142,15 @@ public class FederationProcessorImpl imp
         if (config.isDetectExpiredTokens() && lifeTime != null) {
             Date currentDate = new Date();
             if (currentDate.after(lifeTime.getExpires())) {
-                LOG.warn("Token already expired");
+                LOG.warn("RSTR Lifetime expired");
+                throw new ProcessingException(TYPE.TOKEN_EXPIRED);
             }
-            if (currentDate.before(lifeTime.getCreated())) {
-                LOG.warn("Token not yet valid");
-                // [TODO] Add Check clockskew
+            DateTime currentTime = new DateTime();
+            DateTime validFrom = new DateTime(lifeTime.created);
+            currentTime = currentTime.plusSeconds(config.getMaximumClockSkew().intValue());
+            if (validFrom.isAfter(currentTime)) {
+                LOG.debug("RSTR Lifetime not yet valid");
+                throw new ProcessingException(TYPE.TOKEN_INVALID);
             }
         }
 
@@ -353,25 +358,18 @@ public class FederationProcessorImpl imp
                     .append(URLEncoder.encode(homeRealm, "UTF-8"));
             }
             
+            // add wct
+            Date creationTime = new Date();
+            XmlSchemaDateFormat fmt = new XmlSchemaDateFormat();
+            String wct = fmt.format(creationTime);
+            sb.append('&').append(FederationConstants.PARAM_CURRENT_TIME).append('=')
+            .append(URLEncoder.encode(wct, "UTF-8"));
+            
             redirectURL = redirectURL + "?" + sb.toString();
         } catch (Exception ex) {
             LOG.error("Failed to create SignInRequest", ex);
             throw new ProcessingException("Failed to create SignInRequest");
-        }
-        // [TODO] Current time, wct
-
-        // if (false) {
-        // sb.append("&");
-        // sb.append("wfresh=jjjj");
-        // }
-        // if (false) {
-        // sb.append("&");wct
-        // sb.append("wreq=jjjj");
-        // }
-        // if (false) {
-        // sb.append("&");
-        // sb.append("wct=").append("jjjj");
-        // }
+        }        
         return redirectURL;
     }
 

Propchange: cxf/fediz/trunk/plugins/tomcat/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jun 14 19:57:05 2012
@@ -0,0 +1,8 @@
+target
+.classpath
+.pmd
+.settings
+.ruleset
+.project
+.checkstyle
+



Mime
View raw message