Author: ashakirin
Date: Sun Dec 16 18:25:34 2012
New Revision: 1422658
URL: http://svn.apache.org/viewvc?rev=1422658&view=rev
Log:
Fix for CXF-4668
Added:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SamlCustomHandler.java
(with props)
Modified:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SAMLTokenProvider.java
Modified:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SAMLTokenProvider.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SAMLTokenProvider.java?rev=1422658&r1=1422657&r2=1422658&view=diff
==============================================================================
---
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SAMLTokenProvider.java
(original)
+++
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SAMLTokenProvider.java
Sun Dec 16 18:25:34 2012
@@ -75,6 +75,7 @@ public class SAMLTokenProvider implement
private ConditionsProvider conditionsProvider = new
DefaultConditionsProvider();
private boolean signToken = true;
private Map<String, SAMLRealm> realmMap = new HashMap<String, SAMLRealm>();
+ private SamlCustomHandler samlCustomHandler;
/**
* Return true if this TokenProvider implementation is capable of
providing a token
@@ -312,6 +313,10 @@ public class SAMLTokenProvider implement
return realmMap;
}
+ public void setSamlCustomHandler(SamlCustomHandler samlCustomHandler) {
+ this.samlCustomHandler = samlCustomHandler;
+ }
+
private AssertionWrapper createSamlToken(
TokenProviderParameters tokenParameters, byte[] secret, Document doc
) throws Exception {
@@ -327,6 +332,10 @@ public class SAMLTokenProvider implement
samlParms.setCallbackHandler(handler);
AssertionWrapper assertion = new AssertionWrapper(samlParms);
+ if (samlCustomHandler != null) {
+ samlCustomHandler.handle(assertion, tokenParameters);
+ }
+
if (signToken) {
STSPropertiesMBean stsProperties =
tokenParameters.getStsProperties();
Added:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SamlCustomHandler.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SamlCustomHandler.java?rev=1422658&view=auto
==============================================================================
---
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SamlCustomHandler.java
(added)
+++
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SamlCustomHandler.java
Sun Dec 16 18:25:34 2012
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.sts.token.provider;
+
+import org.apache.ws.security.saml.ext.AssertionWrapper;
+
+/**
+ * Implementation of this interface updates SAML tokens in any custom way
before it will be signed by
+ * SAMLTokenProvider. Interface is designed to provide a possibility to change
SAML properties not controlled
+ * by WSS4J.
+ */
+public interface SamlCustomHandler {
+
+ void handle(AssertionWrapper assertionWrapper, TokenProviderParameters
tokenParameters);
+}
Propchange:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SamlCustomHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain