This is an automated email from the ASF dual-hosted git repository. coheigea pushed a commit to branch 3.2.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 8633213dff462509be1507475914e457af0800f5 Author: Thomas Papke <thomas.pa...@icw.de> AuthorDate: Fri Oct 5 11:21:03 2018 +0200 Fix issue if lifetime only specify expired without created * Fix cxf checkstyle issues (cherry picked from commit 4d36d982ffe8894f66d16bfc9199792f90d6e02a) --- .../org/apache/cxf/sts/token/provider/DefaultConditionsProvider.java | 4 ++-- .../org/apache/cxf/sts/token/provider/SAMLProviderLifetimeTest.java | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultConditionsProvider.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultConditionsProvider.java index a9252b9..1bf9be4 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultConditionsProvider.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultConditionsProvider.java @@ -141,8 +141,8 @@ public class DefaultConditionsProvider implements ConditionsProvider { Lifetime tokenLifetime = providerParameters.getTokenRequirements().getLifetime(); if (lifetime > 0) { - if (acceptClientLifetime && tokenLifetime != null && - (tokenLifetime.getCreated() != null || tokenLifetime.getExpires() != null)) { + if (acceptClientLifetime && tokenLifetime != null + && (tokenLifetime.getCreated() != null || tokenLifetime.getExpires() != null)) { Instant creationTime = parsedInstantOrDefault(tokenLifetime.getCreated(), Instant.now()); Instant expirationTime = parsedInstantOrDefault(tokenLifetime.getExpires(), creationTime.plusSeconds(lifetime)); diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLProviderLifetimeTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLProviderLifetimeTest.java index d7c3b33..183bbfa 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLProviderLifetimeTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLProviderLifetimeTest.java @@ -23,6 +23,8 @@ import java.time.Instant; import java.time.ZoneOffset; import java.util.Properties; +import org.w3c.dom.Element; + import org.apache.cxf.jaxws.context.WrappedMessageContext; import org.apache.cxf.message.MessageImpl; import org.apache.cxf.sts.STSConstants; @@ -40,7 +42,7 @@ import org.apache.wss4j.common.ext.WSSecurityException; import org.apache.wss4j.common.principal.CustomTokenPrincipal; import org.apache.wss4j.common.util.DOM2Writer; import org.apache.wss4j.common.util.DateUtil; -import org.w3c.dom.Element; + /**