Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2F05E118A5 for ; Thu, 28 Aug 2014 10:25:59 +0000 (UTC) Received: (qmail 41226 invoked by uid 500); 28 Aug 2014 10:25:59 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 41192 invoked by uid 500); 28 Aug 2014 10:25:59 -0000 Mailing-List: contact issues-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 issues@cxf.apache.org Received: (qmail 41032 invoked by uid 99); 28 Aug 2014 10:25:59 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Aug 2014 10:25:59 +0000 Date: Thu, 28 Aug 2014 10:25:58 +0000 (UTC) From: "Willem Salembier (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CXF-5975) SecurityToken::isExpired: add clock skew option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-5975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Willem Salembier updated CXF-5975: ---------------------------------- Description: We notice race conditions with some of our clients when CXF verifies if SecurityTokens cached locally are still valid or expired. One reason could be clock desynchronization, another reason is that while the token was still valid at the moment of request construction, it isn't when the SOAP message arrives on the server (1s difference suffices). Is it possible to add a clock skew option to org.apache.cxf.ws.security.tokenstore.SecurityToken.isExpired() or org.apache.cxf.ws.security.trust.STSClient to compensate clock differences between client and server. Our current workaround is to subclass the STSClient class. {code} public class STSClockSkewClient extends STSClient { private static final int CLOCK_SKEW = 15 * 1000 /* 15s */; public STSClockSkewClient(Bus b) { super(b); } @Override protected SecurityToken createSecurityToken(Element el, byte[] requestorEntropy) throws WSSecurityException { SecurityToken securityToken = super.createSecurityToken(el, requestorEntropy); Date expires = securityToken.getExpires(); if (expires != null) { securityToken.setExpires(new Date(expires.getTime() - CLOCK_SKEW)); } return securityToken; } } {code} A possible workaround is to handle this in the STS and set Lifetime>Expires in the RSTR response not equal but some time before the end of the SAML token, but most of the times the STS clients have no control over the STS service and cannot ask the service provider to make this change. was: We notice race conditions with some of our clients when CXF verifies if SecurityTokens cached locally are still valid or expired. One reason could be clock desynchronization, another reason is that while the token was still valid at the moment of request construction, it isn't when the SOAP message arrives on the server (1s difference suffices). Is it possible to add a clock skew option to org.apache.cxf.ws.security.tokenstore.SecurityToken.isExpired() or org.apache.cxf.ws.security.trust.STSClient to compensate clock differences between client and server. Our current workaround is to subclass the STSClient class. {code} public class STSClockSkewClient extends STSClient { private static final int CLOCK_SKEW = 15 * 1000 /* 15s */; public STSClockSkewClient(Bus b) { super(b); } @Override protected SecurityToken createSecurityToken(Element el, byte[] requestorEntropy) throws WSSecurityException { SecurityToken securityToken = super.createSecurityToken(el, requestorEntropy); Date expires = securityToken.getExpires(); if (expires != null) { securityToken.setExpires(new Date(expires.getTime() - CLOCK_SKEW)); } return securityToken; } } {/code} A possible workaround is to handle this in the STS and set Lifetime>Expires in the RSTR response not equal but some time before the end of the SAML token, but most of the times the STS clients have no control over the STS service and cannot ask the service provider to make this change. > SecurityToken::isExpired: add clock skew option > ----------------------------------------------- > > Key: CXF-5975 > URL: https://issues.apache.org/jira/browse/CXF-5975 > Project: CXF > Issue Type: Improvement > Affects Versions: 2.7.10, 2.7.12 > Reporter: Willem Salembier > Fix For: 2.7.13 > > > We notice race conditions with some of our clients when CXF verifies if SecurityTokens cached locally are still valid or expired. One reason could be clock desynchronization, another reason is that while the token was still valid at the moment of request construction, it isn't when the SOAP message arrives on the server (1s difference suffices). > Is it possible to add a clock skew option to org.apache.cxf.ws.security.tokenstore.SecurityToken.isExpired() or org.apache.cxf.ws.security.trust.STSClient to compensate clock differences between client and server. > Our current workaround is to subclass the STSClient class. > {code} > public class STSClockSkewClient extends STSClient { > private static final int CLOCK_SKEW = 15 * 1000 /* 15s */; > public STSClockSkewClient(Bus b) { > super(b); > } > @Override > protected SecurityToken createSecurityToken(Element el, byte[] requestorEntropy) throws WSSecurityException { > SecurityToken securityToken = super.createSecurityToken(el, requestorEntropy); > Date expires = securityToken.getExpires(); > if (expires != null) { > securityToken.setExpires(new Date(expires.getTime() - CLOCK_SKEW)); > } > return securityToken; > } > } > {code} > A possible workaround is to handle this in the STS and set Lifetime>Expires in the RSTR response not equal but some time before the end of the SAML token, but most of the times the STS clients have no control over the STS service and cannot ask the service provider to make this change. -- This message was sent by Atlassian JIRA (v6.2#6252)