cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1560086 - in /cxf/trunk/services/sts: sts-core/src/main/java/org/apache/cxf/sts/operation/ sts-core/src/main/java/org/apache/cxf/sts/token/provider/ systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/
Date Tue, 21 Jan 2014 16:49:30 GMT
Author: coheigea
Date: Tue Jan 21 16:49:29 2014
New Revision: 1560086

URL: http://svn.apache.org/r1560086
Log:
Removing deprecated API from the STS

Modified:
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/TokenProviderParameters.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/TokenProviderResponse.java
    cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SCTSAMLTokenProvider.java

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java?rev=1560086&r1=1560085&r2=1560086&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
Tue Jan 21 16:49:29 2014
@@ -284,9 +284,7 @@ public abstract class AbstractOperation 
      * Create a LifetimeType object given a created + expires Dates
      */
     protected static LifetimeType createLifetime(
-        Date tokenCreated, 
-        Date tokenExpires,
-        long lifetime
+        Date tokenCreated, Date tokenExpires
     ) {
         AttributedDateTime created = QNameConstants.UTIL_FACTORY.createAttributedDateTime();
         AttributedDateTime expires = QNameConstants.UTIL_FACTORY.createAttributedDateTime();
@@ -298,10 +296,7 @@ public abstract class AbstractOperation 
         Date expirationTime = tokenExpires;
         if (expirationTime == null) {
             expirationTime = new Date();
-            long lifeTimeOfToken = lifetime;
-            if (lifeTimeOfToken <= 0) {
-                lifeTimeOfToken = 300L;
-            }
+            long lifeTimeOfToken = 300L;
             expirationTime.setTime(creationTime.getTime() + (lifeTimeOfToken * 1000L));
         }
 

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java?rev=1560086&r1=1560085&r2=1560086&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java
Tue Jan 21 16:49:29 2014
@@ -358,8 +358,7 @@ public class TokenIssueOperation extends
 
         // Lifetime
         LifetimeType lifetime = 
-            createLifetime(tokenResponse.getCreated(), tokenResponse.getExpires(),
-                           tokenResponse.getLifetime());
+            createLifetime(tokenResponse.getCreated(), tokenResponse.getExpires());
         JAXBElement<LifetimeType> lifetimeType = QNameConstants.WS_TRUST_FACTORY.createLifetime(lifetime);
         response.getAny().add(lifetimeType);
 

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java?rev=1560086&r1=1560085&r2=1560086&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java
Tue Jan 21 16:49:29 2014
@@ -280,8 +280,7 @@ public class TokenRenewOperation extends
 
         // Lifetime
         LifetimeType lifetime = 
-            createLifetime(tokenRenewerResponse.getCreated(), tokenRenewerResponse.getExpires(),
-                           tokenRenewerResponse.getLifetime());
+            createLifetime(tokenRenewerResponse.getCreated(), tokenRenewerResponse.getExpires());
         JAXBElement<LifetimeType> lifetimeType = QNameConstants.WS_TRUST_FACTORY.createLifetime(lifetime);
         response.getAny().add(lifetimeType);
 

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java?rev=1560086&r1=1560085&r2=1560086&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java
Tue Jan 21 16:49:29 2014
@@ -234,8 +234,7 @@ public class TokenValidateOperation exte
             
             // Lifetime
             LifetimeType lifetime = 
-                createLifetime(tokenProviderResponse.getCreated(), tokenProviderResponse.getExpires(),
-                               tokenProviderResponse.getLifetime());
+                createLifetime(tokenProviderResponse.getCreated(), tokenProviderResponse.getExpires());
             JAXBElement<LifetimeType> lifetimeType =
                 QNameConstants.WS_TRUST_FACTORY.createLifetime(lifetime);
             response.getAny().add(lifetimeType);

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/TokenProviderParameters.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/TokenProviderParameters.java?rev=1560086&r1=1560085&r2=1560086&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/TokenProviderParameters.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/TokenProviderParameters.java
Tue Jan 21 16:49:29 2014
@@ -93,14 +93,6 @@ public class TokenProviderParameters {
         this.keyRequirements = keyRequirements;
     }
 
-    @Deprecated
-    public RequestClaimCollection getRequestedClaims() {
-        if (requestedPrimaryClaims != null) {
-            return requestedPrimaryClaims;
-        }
-        return requestedSecondaryClaims;
-    }
-
     public STSPropertiesMBean getStsProperties() {
         return stsProperties;
     }

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/TokenProviderResponse.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/TokenProviderResponse.java?rev=1560086&r1=1560085&r2=1560086&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/TokenProviderResponse.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/TokenProviderResponse.java
Tue Jan 21 16:49:29 2014
@@ -37,7 +37,6 @@ public class TokenProviderResponse {
     private TokenReference unAttachedReference;
     private Date created;
     private Date expires;
-    private long lifetime;
     
     /**
      * Return true if the entropy represents a Computed Key.
@@ -179,22 +178,4 @@ public class TokenProviderResponse {
         this.expires = expires;
     }
 
-    /**
-     * Set the lifetime of the Token to be returned in seconds.
-     * @deprecated use setCreated/setExpires instead
-     * @param lifetime the lifetime of the Token to be returned in seconds
-     */
-    public void setLifetime(long lifetime) {
-        this.lifetime = lifetime;
-    }
-
-    /**
-     * Get the lifetime of the Token to be returned in seconds
-     * @deprecated use getCreated/getExpires instead
-     * @return the lifetime of the Token to be returned in seconds
-     */
-    public long getLifetime() {
-        return lifetime;
-    }
-    
 }

Modified: cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SCTSAMLTokenProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SCTSAMLTokenProvider.java?rev=1560086&r1=1560085&r2=1560086&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SCTSAMLTokenProvider.java
(original)
+++ cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SCTSAMLTokenProvider.java
Tue Jan 21 16:49:29 2014
@@ -54,6 +54,9 @@ import org.apache.wss4j.common.saml.bean
 import org.apache.wss4j.common.saml.bean.SubjectBean;
 import org.apache.wss4j.dom.WSConstants;
 
+import org.joda.time.DateTime;
+import org.opensaml.common.SAMLVersion;
+
 /**
  * A TokenProvider implementation that provides a SAML Token that contains a Symmetric Key
that is obtained
  * from the TokenProviderParameter properties.
@@ -113,7 +116,19 @@ public class SCTSAMLTokenProvider implem
             } else {
                 response.setTokenId(token.getAttributeNS(null, "AssertionID"));
             }
-            response.setLifetime(conditionsProvider.getLifetime());
+            
+            DateTime validFrom = null;
+            DateTime validTill = null;
+            if (assertion.getSamlVersion().equals(SAMLVersion.VERSION_20)) {
+                validFrom = assertion.getSaml2().getConditions().getNotBefore();
+                validTill = assertion.getSaml2().getConditions().getNotOnOrAfter();
+            } else {
+                validFrom = assertion.getSaml1().getConditions().getNotBefore();
+                validTill = assertion.getSaml1().getConditions().getNotOnOrAfter();
+            }
+            response.setCreated(validFrom.toDate());
+            response.setExpires(validTill.toDate());
+            
             response.setEntropy(entropyBytes);
             if (keySize > 0) {
                 response.setKeySize(keySize);



Mime
View raw message