You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2013/04/18 15:54:01 UTC
svn commit: r1469328 - in /webservices/wss4j/trunk:
ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/
ws-security-stax/src/main/java/org/apache/wss4j/stax/
ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/ ws-security-sta...
Author: coheigea
Date: Thu Apr 18 13:54:01 2013
New Revision: 1469328
URL: http://svn.apache.org/r1469328
Log:
Use a separate SAML CallbackHandler specifically for SAML as per the DOM code
Added:
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLCallbackHandlerImpl.java
- copied, changed from r1469299, webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/CallbackHandlerImpl.java
Modified:
webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/WSSec.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSSecurityProperties.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/CallbackHandlerImpl.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenReferenceTest.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenSVTest.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenTest.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SamlConditionsTest.java
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java?rev=1469328&r1=1469327&r2=1469328&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java Thu Apr 18 13:54:01 2013
@@ -32,6 +32,7 @@ import org.apache.wss4j.policy.stax.Poli
import org.apache.wss4j.stax.ext.WSSConstants;
import org.apache.wss4j.stax.ext.WSSSecurityProperties;
import org.apache.wss4j.stax.test.CallbackHandlerImpl;
+import org.apache.wss4j.stax.test.saml.SAMLCallbackHandlerImpl;
import org.apache.xml.security.stax.ext.SecurePart;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -2210,13 +2211,14 @@ public class AsymmetricBindingIntegratio
WSSSecurityProperties outSecurityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.TIMESTAMP, WSSConstants.USERNAMETOKEN, WSSConstants.SAML_TOKEN_SIGNED, WSSConstants.ENCRYPT_WITH_DERIVED_KEY};
outSecurityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
- callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
- callbackHandler.setIssuer("www.example.com");
+ SAMLCallbackHandlerImpl samlCallbackHandler = new SAMLCallbackHandlerImpl();
+ samlCallbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
+ samlCallbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
+ samlCallbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
+ samlCallbackHandler.setIssuer("www.example.com");
byte[] secret = new byte[128 / 8];
WSSConstants.secureRandom.nextBytes(secret);
+ CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
callbackHandler.setSecret(secret);
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
@@ -2224,8 +2226,9 @@ public class AsymmetricBindingIntegratio
crypto.setKeyStore(keyStore);
CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
cryptoType.setAlias("transmitter");
- callbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
+ samlCallbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
outSecurityProperties.setCallbackHandler(callbackHandler);
+ outSecurityProperties.setSamlCallbackHandler(samlCallbackHandler);
outSecurityProperties.setTokenUser("tester");
outSecurityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
outSecurityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
@@ -2334,13 +2337,14 @@ public class AsymmetricBindingIntegratio
WSSSecurityProperties outSecurityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.TIMESTAMP, WSSConstants.USERNAMETOKEN, WSSConstants.SAML_TOKEN_SIGNED, WSSConstants.ENCRYPT_WITH_DERIVED_KEY};
outSecurityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
- callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
- callbackHandler.setIssuer("www.example.com");
+ SAMLCallbackHandlerImpl samlCallbackHandler = new SAMLCallbackHandlerImpl();
+ samlCallbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
+ samlCallbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
+ samlCallbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
+ samlCallbackHandler.setIssuer("www.example.com");
byte[] secret = new byte[128 / 8];
WSSConstants.secureRandom.nextBytes(secret);
+ CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
callbackHandler.setSecret(secret);
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
@@ -2348,8 +2352,9 @@ public class AsymmetricBindingIntegratio
crypto.setKeyStore(keyStore);
CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
cryptoType.setAlias("transmitter");
- callbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
+ samlCallbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
outSecurityProperties.setCallbackHandler(callbackHandler);
+ outSecurityProperties.setSamlCallbackHandler(samlCallbackHandler);
outSecurityProperties.setTokenUser("tester");
outSecurityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
outSecurityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/WSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/WSSec.java?rev=1469328&r1=1469327&r2=1469328&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/WSSec.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/WSSec.java Thu Apr 18 13:54:01 2013
@@ -276,6 +276,9 @@ public class WSSec {
if (securityProperties.getCallbackHandler() == null) {
throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noCallback");
}
+ if (securityProperties.getSamlCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noSAMLCallbackHandler");
+ }
if (securityProperties.getSignatureAlgorithm() == null) {
securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
}
@@ -289,8 +292,8 @@ public class WSSec {
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
}
} else if (WSSConstants.SAML_TOKEN_UNSIGNED.equals(action) &&
- (securityProperties.getCallbackHandler() == null)) {
- throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noCallback");
+ (securityProperties.getSamlCallbackHandler() == null)) {
+ throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noSAMLCallbackHandler");
} else if (WSSConstants.SIGNATURE_WITH_KERBEROS_TOKEN.equals(action)) {
if (securityProperties.getCallbackHandler() == null) {
throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noCallback");
Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSSecurityProperties.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSSecurityProperties.java?rev=1469328&r1=1469327&r2=1469328&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSSecurityProperties.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSSecurityProperties.java Thu Apr 18 13:54:01 2013
@@ -54,6 +54,7 @@ public class WSSSecurityProperties exten
private String actor;
private CallbackHandler callbackHandler;
+ private CallbackHandler samlCallbackHandler;
private final List<BSPRule> ignoredBSPRules = new LinkedList<BSPRule>();
private boolean disableBSPEnforcement;
private final Map<QName, Validator> validators = new HashMap<QName, Validator>();
@@ -109,6 +110,7 @@ public class WSSSecurityProperties exten
this.actor = wssSecurityProperties.actor;
this.callbackHandler = wssSecurityProperties.callbackHandler;
+ this.samlCallbackHandler = wssSecurityProperties.samlCallbackHandler;
this.ignoredBSPRules.addAll(wssSecurityProperties.ignoredBSPRules);
this.disableBSPEnforcement = wssSecurityProperties.disableBSPEnforcement;
this.validators.putAll(wssSecurityProperties.validators);
@@ -741,5 +743,13 @@ public class WSSSecurityProperties exten
public void setAddUsernameTokenCreated(boolean addUsernameTokenCreated) {
this.addUsernameTokenCreated = addUsernameTokenCreated;
}
+
+ public CallbackHandler getSamlCallbackHandler() {
+ return samlCallbackHandler;
+ }
+
+ public void setSamlCallbackHandler(CallbackHandler samlCallbackHandler) {
+ this.samlCallbackHandler = samlCallbackHandler;
+ }
}
Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java?rev=1469328&r1=1469327&r2=1469328&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java Thu Apr 18 13:54:01 2013
@@ -64,7 +64,7 @@ public class SAMLTokenOutputProcessor ex
try {
final SAMLCallback samlCallback = new SAMLCallback();
- SAMLUtil.doSAMLCallback(((WSSSecurityProperties) getSecurityProperties()).getCallbackHandler(), samlCallback);
+ SAMLUtil.doSAMLCallback(((WSSSecurityProperties) getSecurityProperties()).getSamlCallbackHandler(), samlCallback);
SamlAssertionWrapper samlAssertionWrapper = new SamlAssertionWrapper(samlCallback);
if (samlCallback.isSignAssertion()) {
Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/CallbackHandlerImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/CallbackHandlerImpl.java?rev=1469328&r1=1469327&r2=1469328&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/CallbackHandlerImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/CallbackHandlerImpl.java Thu Apr 18 13:54:01 2013
@@ -18,36 +18,15 @@
*/
package org.apache.wss4j.stax.test;
-import org.apache.wss4j.dom.WSConstants;
-import org.apache.wss4j.common.crypto.Merlin;
-import org.apache.wss4j.common.ext.WSPasswordCallback;
-import org.apache.wss4j.common.saml.SAMLCallback;
-import org.apache.wss4j.common.saml.bean.ActionBean;
-import org.apache.wss4j.common.saml.bean.AttributeBean;
-import org.apache.wss4j.common.saml.bean.AttributeStatementBean;
-import org.apache.wss4j.common.saml.bean.AuthDecisionStatementBean;
-import org.apache.wss4j.common.saml.bean.AuthenticationStatementBean;
-import org.apache.wss4j.common.saml.bean.ConditionsBean;
-import org.apache.wss4j.common.saml.bean.KeyInfoBean;
-import org.apache.wss4j.common.saml.bean.SubjectBean;
-import org.apache.wss4j.common.saml.bean.SubjectLocalityBean;
-import org.apache.wss4j.common.saml.builder.SAML1Constants;
-import org.apache.wss4j.common.saml.builder.SAML2Constants;
-import org.apache.wss4j.dom.message.WSSecEncryptedKey;
-import org.opensaml.common.SAMLVersion;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
+import java.io.IOException;
+import java.security.cert.X509Certificate;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.io.IOException;
-import java.security.KeyStore;
-import java.security.cert.X509Certificate;
-import java.util.Collections;
-import java.util.List;
+
+import org.apache.wss4j.common.ext.WSPasswordCallback;
+import org.apache.wss4j.common.saml.builder.SAML1Constants;
public class CallbackHandlerImpl implements CallbackHandler {
@@ -62,20 +41,8 @@ public class CallbackHandlerImpl impleme
private String subjectQualifier = "www.example.com";
private String confirmationMethod = SAML1Constants.CONF_SENDER_VOUCHES;
private X509Certificate[] certs;
- private Statement statement = Statement.AUTHN;
- private KeyInfoBean.CERT_IDENTIFIER certIdentifier = KeyInfoBean.CERT_IDENTIFIER.X509_CERT;
private byte[] ephemeralKey = null;
private String issuer = null;
- private SAMLVersion samlVersion = SAMLVersion.VERSION_11;
-
- private String subjectNameIDFormat = null;
- private String subjectLocalityIpAddress = null;
- private String subjectLocalityDnsAddress = null;
- private String resource = null;
- private List<?> customAttributeValues = null;
- private ConditionsBean conditions = null;
-
- private boolean signAssertion = true;
public CallbackHandlerImpl() {
}
@@ -106,137 +73,7 @@ public class CallbackHandlerImpl impleme
} else {
throw new UnsupportedCallbackException(pc, "Unrecognized CallbackHandlerImpl");
}
- } else if (callbacks[0] instanceof SAMLCallback) {
- try {
- SAMLCallback samlCallback = (SAMLCallback) callbacks[0];
- KeyStore keyStore = KeyStore.getInstance("jks");
- keyStore.load(this.getClass().getClassLoader().getResourceAsStream("saml/issuer.jks"), "default".toCharArray());
- Merlin crypto = new Merlin();
- crypto.setKeyStore(keyStore);
- samlCallback.setIssuerCrypto(crypto);
- samlCallback.setIssuerKeyName("samlissuer");
- samlCallback.setIssuerKeyPassword("default");
- samlCallback.setSignAssertion(this.signAssertion);
- samlCallback.setIssuer(issuer);
-
- if (conditions != null) {
- samlCallback.setConditions(conditions);
- }
-
- SubjectBean subjectBean =
- new SubjectBean(subjectName, subjectQualifier, confirmationMethod);
- if (subjectNameIDFormat != null) {
- subjectBean.setSubjectNameIDFormat(subjectNameIDFormat);
- }
-
- if (SAML1Constants.CONF_HOLDER_KEY.equals(confirmationMethod)
- || SAML2Constants.CONF_HOLDER_KEY.equals(confirmationMethod)) {
- try {
- KeyInfoBean keyInfo = createKeyInfo();
- subjectBean.setKeyInfo(keyInfo);
- } catch (Exception ex) {
- throw new IOException("Problem creating KeyInfo: " + ex.getMessage());
- }
- }
- samlCallback.setSubject(subjectBean);
-
- if (getSamlVersion() == SAMLVersion.VERSION_11) {
- samlCallback.setSamlVersion(SAMLVersion.VERSION_11);
- createAndSetStatement(subjectBean, samlCallback);
- } else {
- samlCallback.setSamlVersion(SAMLVersion.VERSION_20);
- createAndSetStatement(null, samlCallback);
- }
- } catch (Exception e) {
- throw new IOException(e);
- }
- }
- }
-
- /**
- * Note that the SubjectBean parameter should be null for SAML2.0
- */
- protected void createAndSetStatement(SubjectBean subjectBean, SAMLCallback callback) {
- if (statement == Statement.AUTHN) {
- AuthenticationStatementBean authBean = new AuthenticationStatementBean();
- if (subjectBean != null) {
- authBean.setSubject(subjectBean);
- }
- if (subjectLocalityIpAddress != null || subjectLocalityDnsAddress != null) {
- SubjectLocalityBean subjectLocality = new SubjectLocalityBean();
- subjectLocality.setIpAddress(subjectLocalityIpAddress);
- subjectLocality.setDnsAddress(subjectLocalityDnsAddress);
- authBean.setSubjectLocality(subjectLocality);
- }
- authBean.setAuthenticationMethod("Password");
- callback.setAuthenticationStatementData(Collections.singletonList(authBean));
- } else if (statement == Statement.ATTR) {
- AttributeStatementBean attrBean = new AttributeStatementBean();
- AttributeBean attributeBean = new AttributeBean();
- if (subjectBean != null) {
- attrBean.setSubject(subjectBean);
- attributeBean.setSimpleName("role");
- attributeBean.setQualifiedName("http://custom-ns");
- } else {
- attributeBean.setQualifiedName("role");
- }
- if (customAttributeValues != null) {
- attributeBean.setCustomAttributeValues(customAttributeValues);
- } else {
- attributeBean.setAttributeValues(Collections.singletonList("user"));
- }
- attrBean.setSamlAttributes(Collections.singletonList(attributeBean));
- callback.setAttributeStatementData(Collections.singletonList(attrBean));
- } else {
- AuthDecisionStatementBean authzBean = new AuthDecisionStatementBean();
- if (subjectBean != null) {
- authzBean.setSubject(subjectBean);
- }
- ActionBean actionBean = new ActionBean();
- actionBean.setContents("Read");
- authzBean.setActions(Collections.singletonList(actionBean));
- authzBean.setResource("endpoint");
- authzBean.setDecision(AuthDecisionStatementBean.Decision.PERMIT);
- authzBean.setResource(resource);
- callback.setAuthDecisionStatementData(Collections.singletonList(authzBean));
- }
- }
-
- protected KeyInfoBean createKeyInfo() throws Exception {
- KeyInfoBean keyInfo = new KeyInfoBean();
- if (statement == Statement.AUTHN) {
- keyInfo.setCertificate(certs[0]);
- keyInfo.setCertIdentifer(certIdentifier);
- } else if (statement == Statement.ATTR) {
- // Build a new Document
- DocumentBuilderFactory docBuilderFactory =
- DocumentBuilderFactory.newInstance();
- docBuilderFactory.setNamespaceAware(true);
- DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
- Document doc = docBuilder.newDocument();
-
- // Create an Encrypted Key
- WSSecEncryptedKey encrKey = new WSSecEncryptedKey();
- encrKey.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
- encrKey.setUseThisCert(certs[0]);
- encrKey.prepare(doc, null);
- ephemeralKey = encrKey.getEphemeralKey();
- keyInfo.setEphemeralKey(ephemeralKey);
- Element encryptedKeyElement = encrKey.getEncryptedKeyElement();
-
- // Append the EncryptedKey to a KeyInfo element
- Element keyInfoElement =
- doc.createElementNS(
- WSConstants.SIG_NS, WSConstants.SIG_PREFIX + ":" + WSConstants.KEYINFO_LN
- );
- keyInfoElement.setAttributeNS(
- WSConstants.XMLNS_NS, "xmlns:" + WSConstants.SIG_PREFIX, WSConstants.SIG_NS
- );
- keyInfoElement.appendChild(encryptedKeyElement);
-
- keyInfo.setElement(keyInfoElement);
}
- return keyInfo;
}
public String getUsername() {
@@ -279,22 +116,6 @@ public class CallbackHandlerImpl impleme
this.certs = certs;
}
- public Statement getStatement() {
- return statement;
- }
-
- public void setStatement(Statement statement) {
- this.statement = statement;
- }
-
- public KeyInfoBean.CERT_IDENTIFIER getCertIdentifier() {
- return certIdentifier;
- }
-
- public void setCertIdentifier(KeyInfoBean.CERT_IDENTIFIER certIdentifier) {
- this.certIdentifier = certIdentifier;
- }
-
public byte[] getEphemeralKey() {
return ephemeralKey;
}
@@ -311,22 +132,6 @@ public class CallbackHandlerImpl impleme
this.issuer = issuer;
}
- public boolean isSignAssertion() {
- return signAssertion;
- }
-
- public void setSignAssertion(boolean signAssertion) {
- this.signAssertion = signAssertion;
- }
-
- public SAMLVersion getSamlVersion() {
- return samlVersion;
- }
-
- public void setSamlVersion(SAMLVersion samlVersion) {
- this.samlVersion = samlVersion;
- }
-
public byte[] getSecret() {
return secret;
}
@@ -335,24 +140,4 @@ public class CallbackHandlerImpl impleme
this.secret = secret;
}
- public void setConditions(ConditionsBean conditionsBean) {
- this.conditions = conditionsBean;
- }
-
- public void setSubjectNameIDFormat(String subjectNameIDFormat) {
- this.subjectNameIDFormat = subjectNameIDFormat;
- }
-
- public void setSubjectLocality(String ipAddress, String dnsAddress) {
- this.subjectLocalityIpAddress = ipAddress;
- this.subjectLocalityDnsAddress = dnsAddress;
- }
-
- public void setResource(String resource) {
- this.resource = resource;
- }
-
- public void setCustomAttributeValues(List<?> customAttributeValues) {
- this.customAttributeValues = customAttributeValues;
- }
}
Copied: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLCallbackHandlerImpl.java (from r1469299, webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/CallbackHandlerImpl.java)
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLCallbackHandlerImpl.java?p2=webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLCallbackHandlerImpl.java&p1=webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/CallbackHandlerImpl.java&r1=1469299&r2=1469328&rev=1469328&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/CallbackHandlerImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLCallbackHandlerImpl.java Thu Apr 18 13:54:01 2013
@@ -16,11 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.wss4j.stax.test;
+package org.apache.wss4j.stax.test.saml;
+
+import java.io.IOException;
+import java.security.KeyStore;
+import java.security.cert.X509Certificate;
+import java.util.Collections;
+import java.util.List;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.wss4j.dom.WSConstants;
import org.apache.wss4j.common.crypto.Merlin;
-import org.apache.wss4j.common.ext.WSPasswordCallback;
import org.apache.wss4j.common.saml.SAMLCallback;
import org.apache.wss4j.common.saml.bean.ActionBean;
import org.apache.wss4j.common.saml.bean.AttributeBean;
@@ -33,26 +43,13 @@ import org.apache.wss4j.common.saml.bean
import org.apache.wss4j.common.saml.bean.SubjectLocalityBean;
import org.apache.wss4j.common.saml.builder.SAML1Constants;
import org.apache.wss4j.common.saml.builder.SAML2Constants;
+import org.apache.wss4j.dom.WSConstants;
import org.apache.wss4j.dom.message.WSSecEncryptedKey;
import org.opensaml.common.SAMLVersion;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.io.IOException;
-import java.security.KeyStore;
-import java.security.cert.X509Certificate;
-import java.util.Collections;
-import java.util.List;
-
-public class CallbackHandlerImpl implements CallbackHandler {
-
- private String username = "default";
- private byte[] secret;
+public class SAMLCallbackHandlerImpl implements CallbackHandler {
public enum Statement {
AUTHN, ATTR, AUTHZ
@@ -77,36 +74,12 @@ public class CallbackHandlerImpl impleme
private boolean signAssertion = true;
- public CallbackHandlerImpl() {
- }
-
- public CallbackHandlerImpl(String username) {
- if (username != null) {
- this.username = username;
- }
- }
-
- public CallbackHandlerImpl(byte[] secret) {
- this.secret = secret;
+ public SAMLCallbackHandlerImpl() {
}
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
- if (callbacks[0] instanceof WSPasswordCallback) {
- WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
-
- if (pc.getUsage() == WSPasswordCallback.Usage.DECRYPT
- || pc.getUsage() == WSPasswordCallback.Usage.SIGNATURE
- || pc.getUsage() == WSPasswordCallback.Usage.USERNAME_TOKEN
- ) {
- pc.setPassword(username);
- } else if (pc.getUsage() == WSPasswordCallback.Usage.SECRET_KEY
- || pc.getUsage() == WSPasswordCallback.Usage.SECURITY_CONTEXT_TOKEN) {
- pc.setKey(secret);
- } else {
- throw new UnsupportedCallbackException(pc, "Unrecognized CallbackHandlerImpl");
- }
- } else if (callbacks[0] instanceof SAMLCallback) {
+ if (callbacks[0] instanceof SAMLCallback) {
try {
SAMLCallback samlCallback = (SAMLCallback) callbacks[0];
KeyStore keyStore = KeyStore.getInstance("jks");
@@ -239,14 +212,6 @@ public class CallbackHandlerImpl impleme
return keyInfo;
}
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
public String getSubjectName() {
return subjectName;
}
@@ -327,14 +292,6 @@ public class CallbackHandlerImpl impleme
this.samlVersion = samlVersion;
}
- public byte[] getSecret() {
- return secret;
- }
-
- public void setSecret(byte[] secret) {
- this.secret = secret;
- }
-
public void setConditions(ConditionsBean conditionsBean) {
this.conditions = conditionsBean;
}
Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java?rev=1469328&r1=1469327&r2=1469328&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java Thu Apr 18 13:54:01 2013
@@ -75,11 +75,11 @@ public class SAMLTokenHOKTest extends Ab
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML1Constants.CONF_HOLDER_KEY);
callbackHandler.setIssuer("www.example.com");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
Merlin crypto = new Merlin();
@@ -89,6 +89,7 @@ public class SAMLTokenHOKTest extends Ab
callbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -176,12 +177,12 @@ public class SAMLTokenHOKTest extends Ab
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML1Constants.CONF_HOLDER_KEY);
callbackHandler.setCertIdentifier(KeyInfoBean.CERT_IDENTIFIER.X509_ISSUER_SERIAL);
callbackHandler.setIssuer("www.example.com");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
Merlin crypto = new Merlin();
@@ -192,6 +193,7 @@ public class SAMLTokenHOKTest extends Ab
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -293,12 +295,12 @@ public class SAMLTokenHOKTest extends Ab
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML1Constants.CONF_HOLDER_KEY);
callbackHandler.setCertIdentifier(KeyInfoBean.CERT_IDENTIFIER.KEY_VALUE);
callbackHandler.setIssuer("www.example.com");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
Merlin crypto = new Merlin();
@@ -309,6 +311,7 @@ public class SAMLTokenHOKTest extends Ab
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -412,11 +415,11 @@ public class SAMLTokenHOKTest extends Ab
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.ATTR);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.ATTR);
callbackHandler.setConfirmationMethod(SAML1Constants.CONF_HOLDER_KEY);
callbackHandler.setIssuer("www.example.com");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
Merlin crypto = new Merlin();
@@ -427,6 +430,7 @@ public class SAMLTokenHOKTest extends Ab
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#hmac-sha256");
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -546,7 +550,7 @@ public class SAMLTokenHOKTest extends Ab
{
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
- securityProperties.setCallbackHandler(new CallbackHandlerImpl());
+ securityProperties.setSamlCallbackHandler(new SAMLCallbackHandlerImpl());
InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
@@ -580,12 +584,12 @@ public class SAMLTokenHOKTest extends Ab
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
callbackHandler.setIssuer("www.example.com");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
Merlin crypto = new Merlin();
@@ -595,6 +599,7 @@ public class SAMLTokenHOKTest extends Ab
callbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -665,13 +670,13 @@ public class SAMLTokenHOKTest extends Ab
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
callbackHandler.setCertIdentifier(KeyInfoBean.CERT_IDENTIFIER.X509_ISSUER_SERIAL);
callbackHandler.setIssuer("www.example.com");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
Merlin crypto = new Merlin();
@@ -682,6 +687,7 @@ public class SAMLTokenHOKTest extends Ab
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -783,13 +789,13 @@ public class SAMLTokenHOKTest extends Ab
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
callbackHandler.setCertIdentifier(KeyInfoBean.CERT_IDENTIFIER.KEY_VALUE);
callbackHandler.setIssuer("www.example.com");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
Merlin crypto = new Merlin();
@@ -800,6 +806,7 @@ public class SAMLTokenHOKTest extends Ab
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -903,12 +910,12 @@ public class SAMLTokenHOKTest extends Ab
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.ATTR);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.ATTR);
callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
callbackHandler.setIssuer("www.example.com");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
Merlin crypto = new Merlin();
@@ -919,6 +926,7 @@ public class SAMLTokenHOKTest extends Ab
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#hmac-sha256");
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenReferenceTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenReferenceTest.java?rev=1469328&r1=1469327&r2=1469328&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenReferenceTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenReferenceTest.java Thu Apr 18 13:54:01 2013
@@ -76,15 +76,16 @@ public class SAMLTokenReferenceTest exte
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML1Constants.CONF_SENDER_VOUCHES);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SkiKeyIdentifier);
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -184,8 +185,8 @@ public class SAMLTokenReferenceTest exte
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML1Constants.CONF_HOLDER_KEY);
callbackHandler.setIssuer("www.example.com");
KeyStore keyStore = KeyStore.getInstance("jks");
@@ -195,10 +196,11 @@ public class SAMLTokenReferenceTest exte
CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
cryptoType.setAlias("transmitter");
callbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -510,9 +512,9 @@ public class SAMLTokenReferenceTest exte
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML2Constants.CONF_SENDER_VOUCHES);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
@@ -523,10 +525,11 @@ public class SAMLTokenReferenceTest exte
CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
cryptoType.setAlias("transmitter");
callbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier);
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -626,9 +629,9 @@ public class SAMLTokenReferenceTest exte
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
callbackHandler.setIssuer("www.example.com");
KeyStore keyStore = KeyStore.getInstance("jks");
@@ -638,10 +641,11 @@ public class SAMLTokenReferenceTest exte
CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
cryptoType.setAlias("transmitter");
callbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -740,9 +744,9 @@ public class SAMLTokenReferenceTest exte
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
callbackHandler.setIssuer("www.example.com");
KeyStore keyStore = KeyStore.getInstance("jks");
@@ -750,10 +754,11 @@ public class SAMLTokenReferenceTest exte
Merlin crypto = new Merlin();
crypto.setKeyStore(keyStore);
callbackHandler.setCerts(crypto.getCertificates("transmitter"));
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
securityProperties.setSignatureKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE);
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenSVTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenSVTest.java?rev=1469328&r1=1469327&r2=1469328&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenSVTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenSVTest.java Thu Apr 18 13:54:01 2013
@@ -61,15 +61,16 @@ public class SAMLTokenSVTest extends Abs
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML1Constants.CONF_SENDER_VOUCHES);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -147,14 +148,15 @@ public class SAMLTokenSVTest extends Abs
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML1Constants.CONF_SENDER_VOUCHES);
callbackHandler.setIssuer("www.example.com");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier);
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -238,15 +240,16 @@ public class SAMLTokenSVTest extends Abs
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.ATTR);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.ATTR);
callbackHandler.setConfirmationMethod(SAML1Constants.CONF_SENDER_VOUCHES);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -344,7 +347,7 @@ public class SAMLTokenSVTest extends Abs
{
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
- securityProperties.setCallbackHandler(new CallbackHandlerImpl());
+ securityProperties.setCallbackHandler(new SAMLCallbackHandlerImpl());
InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
@@ -378,16 +381,17 @@ public class SAMLTokenSVTest extends Abs
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML2Constants.CONF_SENDER_VOUCHES);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -466,16 +470,17 @@ public class SAMLTokenSVTest extends Abs
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.ATTR);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.ATTR);
callbackHandler.setConfirmationMethod(SAML2Constants.CONF_SENDER_VOUCHES);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenTest.java?rev=1469328&r1=1469327&r2=1469328&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenTest.java Thu Apr 18 13:54:01 2013
@@ -26,7 +26,6 @@ import org.apache.wss4j.stax.ext.Outboun
import org.apache.wss4j.stax.ext.WSSConstants;
import org.apache.wss4j.stax.ext.WSSSecurityProperties;
import org.apache.wss4j.stax.test.AbstractTestBase;
-import org.apache.wss4j.stax.test.CallbackHandlerImpl;
import org.apache.wss4j.stax.test.utils.StAX2DOM;
import org.apache.wss4j.stax.test.utils.XmlReaderToWriter;
import org.apache.xml.security.stax.securityEvent.SecurityEvent;
@@ -65,11 +64,11 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -117,7 +116,7 @@ public class SAMLTokenTest extends Abstr
{
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
- securityProperties.setCallbackHandler(new CallbackHandlerImpl());
+ securityProperties.setSamlCallbackHandler(new SAMLCallbackHandlerImpl());
InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
@@ -137,11 +136,11 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.ATTR);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.ATTR);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -189,7 +188,7 @@ public class SAMLTokenTest extends Abstr
{
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
- securityProperties.setCallbackHandler(new CallbackHandlerImpl());
+ securityProperties.setSamlCallbackHandler(new SAMLCallbackHandlerImpl());
InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
@@ -209,12 +208,12 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHZ);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHZ);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
callbackHandler.setResource("http://resource.org");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -263,7 +262,7 @@ public class SAMLTokenTest extends Abstr
{
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
- securityProperties.setCallbackHandler(new CallbackHandlerImpl());
+ securityProperties.setSamlCallbackHandler(new SAMLCallbackHandlerImpl());
InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
@@ -283,12 +282,12 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -336,7 +335,7 @@ public class SAMLTokenTest extends Abstr
{
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
- securityProperties.setCallbackHandler(new CallbackHandlerImpl());
+ securityProperties.setSamlCallbackHandler(new SAMLCallbackHandlerImpl());
InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
@@ -356,12 +355,12 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.ATTR);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.ATTR);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -409,7 +408,7 @@ public class SAMLTokenTest extends Abstr
{
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
- securityProperties.setCallbackHandler(new CallbackHandlerImpl());
+ securityProperties.setSamlCallbackHandler(new SAMLCallbackHandlerImpl());
InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
@@ -429,13 +428,13 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHZ);
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHZ);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
callbackHandler.setResource("http://resource.org");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -484,7 +483,7 @@ public class SAMLTokenTest extends Abstr
{
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
- securityProperties.setCallbackHandler(new CallbackHandlerImpl());
+ securityProperties.setSamlCallbackHandler(new SAMLCallbackHandlerImpl());
InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
@@ -508,12 +507,12 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
callbackHandler.setSubjectNameIDFormat(SAML1Constants.NAMEID_FORMAT_EMAIL_ADDRESS);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -545,13 +544,13 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
callbackHandler.setSubjectNameIDFormat(SAML1Constants.NAMEID_FORMAT_EMAIL_ADDRESS);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -583,12 +582,12 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
callbackHandler.setSubjectLocality("12.34.56.780", "test-dns");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -620,13 +619,13 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
callbackHandler.setSubjectLocality("12.34.56.780", "test-dns");
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -658,12 +657,12 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHZ);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHZ);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setResource("http://resource.org");
callbackHandler.setSignAssertion(false);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
@@ -697,8 +696,8 @@ public class SAMLTokenTest extends Abstr
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_UNSIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.ATTR);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.ATTR);
callbackHandler.setIssuer("www.example.com");
callbackHandler.setSignAssertion(false);
callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
@@ -719,7 +718,7 @@ public class SAMLTokenTest extends Abstr
callbackHandler.setCustomAttributeValues(Collections.singletonList(attributeValue));
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SamlConditionsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SamlConditionsTest.java?rev=1469328&r1=1469327&r2=1469328&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SamlConditionsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SamlConditionsTest.java Thu Apr 18 13:54:01 2013
@@ -64,8 +64,8 @@ public class SamlConditionsTest extends
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
WSSConstants.Action[] actions = new WSSConstants.Action[]{WSSConstants.SAML_TOKEN_SIGNED};
securityProperties.setOutAction(actions);
- CallbackHandlerImpl callbackHandler = new CallbackHandlerImpl();
- callbackHandler.setStatement(CallbackHandlerImpl.Statement.AUTHN);
+ SAMLCallbackHandlerImpl callbackHandler = new SAMLCallbackHandlerImpl();
+ callbackHandler.setStatement(SAMLCallbackHandlerImpl.Statement.AUTHN);
callbackHandler.setIssuer("www.example.com");
ConditionsBean conditions = new ConditionsBean();
@@ -75,9 +75,10 @@ public class SamlConditionsTest extends
conditions.setNotAfter(notAfter);
callbackHandler.setConditions(conditions);
- securityProperties.setCallbackHandler(callbackHandler);
+ securityProperties.setSamlCallbackHandler(callbackHandler);
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
+ securityProperties.setCallbackHandler(new CallbackHandlerImpl());
OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());