Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AC1F7ECA1 for ; Wed, 23 Jan 2013 12:00:15 +0000 (UTC) Received: (qmail 80711 invoked by uid 500); 23 Jan 2013 12:00:14 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 80643 invoked by uid 500); 23 Jan 2013 12:00:13 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 80634 invoked by uid 99); 23 Jan 2013 12:00:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Jan 2013 12:00:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Jan 2013 12:00:12 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2E3FA238897F; Wed, 23 Jan 2013 11:59:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1437358 - in /cxf/fediz/trunk: services/idp/src/main/java/org/apache/cxf/fediz/service/idp/ systests/jetty8/src/test/resources/ systests/tomcat7/src/test/resources/ Date: Wed, 23 Jan 2013 11:59:52 -0000 To: commits@cxf.apache.org From: coheigea@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130123115953.2E3FA238897F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 @@ https://localhost:${idp.https.port}/fediz-idp/ , http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role + 10 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 @@ https://localhost:${idp.https.port}/fediz-idp/ , http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role + 10