You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2013/02/15 15:28:28 UTC

svn commit: r1446598 - /cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/provider/DefaultSecurityTokenServiceProvider.java

Author: coheigea
Date: Fri Feb 15 14:28:28 2013
New Revision: 1446598

URL: http://svn.apache.org/r1446598
Log:
[CXF-4831] - Support renewing SAML Tokens by default in the DefaultSecurityTokenServiceProvider

Modified:
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/provider/DefaultSecurityTokenServiceProvider.java

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/provider/DefaultSecurityTokenServiceProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/provider/DefaultSecurityTokenServiceProvider.java?rev=1446598&r1=1446597&r2=1446598&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/provider/DefaultSecurityTokenServiceProvider.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/provider/DefaultSecurityTokenServiceProvider.java Fri Feb 15 14:28:28 2013
@@ -28,10 +28,13 @@ import org.apache.cxf.sts.STSPropertiesM
 import org.apache.cxf.sts.claims.ClaimsManager;
 import org.apache.cxf.sts.operation.AbstractOperation;
 import org.apache.cxf.sts.operation.TokenIssueOperation;
+import org.apache.cxf.sts.operation.TokenRenewOperation;
 import org.apache.cxf.sts.operation.TokenValidateOperation;
 import org.apache.cxf.sts.service.ServiceMBean;
 import org.apache.cxf.sts.token.provider.SAMLTokenProvider;
 import org.apache.cxf.sts.token.provider.TokenProvider;
+import org.apache.cxf.sts.token.renewer.SAMLTokenRenewer;
+import org.apache.cxf.sts.token.renewer.TokenRenewer;
 import org.apache.cxf.sts.token.validator.SAMLTokenValidator;
 import org.apache.cxf.sts.token.validator.TokenValidator;
 import org.apache.cxf.sts.token.validator.UsernameTokenValidator;
@@ -42,7 +45,8 @@ import org.apache.cxf.ws.security.tokens
 /**
  * A "default" SecurityTokenServiceProvider implementation that defines the Issue and Validate
  * Operations of the STS and adds support for issuing and validating SAML Assertions, and
- * validating UsernameTokens and X.509 Tokens.
+ * validating UsernameTokens and X.509 Tokens. It also defines the Renew Operation for SAML
+ * tokens.
  */
 public class DefaultSecurityTokenServiceProvider extends SecurityTokenServiceProvider {
     
@@ -89,6 +93,9 @@ public class DefaultSecurityTokenService
         if (getValidateOperation() == null) {
             setValidateOperation(createTokenValidateOperation());
         }
+        if (getRenewOperation() == null) {
+            setRenewOperation(createTokenRenewOperation());
+        }
         return super.invoke(request);
     }
     
@@ -106,6 +113,17 @@ public class DefaultSecurityTokenService
         return validateOperation;
     }
     
+    private TokenRenewOperation createTokenRenewOperation() {
+        TokenRenewOperation renewOperation = new TokenRenewOperation();
+        populateAbstractOperation(renewOperation);
+        
+        List<TokenRenewer> tokenRenewers = new ArrayList<TokenRenewer>();
+        tokenRenewers.add(new SAMLTokenRenewer());
+        renewOperation.setTokenRenewers(tokenRenewers);
+        
+        return renewOperation;
+    }
+    
     private void populateAbstractOperation(AbstractOperation abstractOperation) {
         List<TokenProvider> tokenProviders = new ArrayList<TokenProvider>();
         tokenProviders.add(new SAMLTokenProvider());