Author: coheigea
Date: Wed Jan 23 11:59:52 2013
New Revision: 1437358
URL: http://svn.apache.org/viewvc?rev=1437358&view=rev
Log:
[FEDIZ-48] - Support wfresh properly in the IdP
Modified:
cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/FederationFilter.java
cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSClientFilter.java
cxf/fediz/trunk/systests/jetty8/src/test/resources/fediz_config.xml
cxf/fediz/trunk/systests/tomcat7/src/test/resources/fediz_config.xml
Modified:
cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/FederationFilter.java
URL:
http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/FederationFilter.java?rev=1437358&r1=1437357&r2=1437358&view=diff
==============================================================================
---
cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/FederationFilter.java
(original)
+++
cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/FederationFilter.java
Wed Jan 23 11:59:52 2013
@@ -116,6 +116,7 @@ public class FederationFilter extends Ab
context.put(PARAM_WREPLY, wreply);
context.put(PARAM_WAUTH, wauth);
context.put(PARAM_ACTION, action);
+ context.put(PARAM_WFRESH, wfresh);
SecurityToken idpToken = null;
Modified:
cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSClientFilter.java
URL:
http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSClientFilter.java?rev=1437358&r1=1437357&r2=1437358&view=diff
==============================================================================
---
cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSClientFilter.java
(original)
+++
cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSClientFilter.java
Wed Jan 23 11:59:52 2013
@@ -249,15 +249,8 @@ public class STSClientFilter extends Abs
sts.getProperties().put(SecurityConstants.PASSWORD, password);
}
-
- /*
- if (getInitParameter(S_PARAM_TOKEN_INTERNAL_LIFETIME) != null) {
- sts.setEnableLifetime(true);
- int ttl =
Integer.parseInt(getInitParameter(S_PARAM_TOKEN_INTERNAL_LIFETIME));
- sts.setTtl(ttl);
- }
- */
-
+ // Set TTL on the request if wfresh is configured
+ configureTTL(sts, context);
if (appliesTo.startsWith("$")) {
resolvedAppliesTo =
(String)context.get(appliesTo.substring(1));
@@ -377,6 +370,21 @@ public class STSClientFilter extends Abs
return writer.getDocument().getDocumentElement();
}
+ private void configureTTL(IdpSTSClient sts, AuthContext context) {
+ String wfresh = (String)context.get(FederationFilter.PARAM_WFRESH);
+ if (wfresh != null) {
+ try {
+ int ttl = Integer.parseInt(wfresh);
+ if (ttl > 0) {
+ sts.setTtl(ttl * 60);
+ sts.setEnableLifetime(true);
+ }
+ } catch (NumberFormatException ex) {
+ LOG.error("Invalid wfresh value '" + wfresh + "': " +
ex.getMessage());
+ }
+ }
+ }
+
private synchronized void setSTSWsdlUrl(String wsdlUrl) {
this.stsWsdlUrl = wsdlUrl;
this.isPortSet = true;
Modified: cxf/fediz/trunk/systests/jetty8/src/test/resources/fediz_config.xml
URL:
http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/jetty8/src/test/resources/fediz_config.xml?rev=1437358&r1=1437357&r2=1437358&view=diff
==============================================================================
--- cxf/fediz/trunk/systests/jetty8/src/test/resources/fediz_config.xml
(original)
+++ cxf/fediz/trunk/systests/jetty8/src/test/resources/fediz_config.xml Wed Jan
23 11:59:52 2013
@@ -24,6 +24,7 @@
<issuer>https://localhost:${idp.https.port}/fediz-idp/</issuer>
<roleDelimiter>,</roleDelimiter>
<roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
+ <freshness>10</freshness>
<claimTypesRequested>
<claimType type="a particular claim type"
optional="true" />
</claimTypesRequested>
Modified: cxf/fediz/trunk/systests/tomcat7/src/test/resources/fediz_config.xml
URL:
http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/tomcat7/src/test/resources/fediz_config.xml?rev=1437358&r1=1437357&r2=1437358&view=diff
==============================================================================
--- cxf/fediz/trunk/systests/tomcat7/src/test/resources/fediz_config.xml
(original)
+++ cxf/fediz/trunk/systests/tomcat7/src/test/resources/fediz_config.xml Wed
Jan 23 11:59:52 2013
@@ -24,6 +24,7 @@
<issuer>https://localhost:${idp.https.port}/fediz-idp/</issuer>
<roleDelimiter>,</roleDelimiter>
<roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI>
+ <freshness>10</freshness>
<claimTypesRequested>
<claimType type="a particular claim type"
optional="true" />
</claimTypesRequested>