Methods Summary |
---|
public void | print(com.sun.xml.wss.impl.policy.mls.MessagePolicy generated)
for ( int i = 0 ; i<generated.size() ; i++ ) {
System.out.println("Type : " + generated.get(i).getType());
if ( PolicyTypeUtil.signaturePolicy(generated.get(i))) {
WSSPolicy p = (WSSPolicy)generated.get(i);
System.out.println("KeyBinding : " + p.getKeyBinding().getType());
SignaturePolicy.FeatureBinding f1 = (SignaturePolicy.FeatureBinding)p.getFeatureBinding();
List<Target> t1 = f1.getTargetBindings();
System.out.println("No of Targets : " + t1.size());
for ( Target t : t1 ) {
System.out.println(t.getType() + " " + t.getValue());
}
}
if ( PolicyTypeUtil.encryptionPolicy(generated.get(i))) {
WSSPolicy p = (WSSPolicy)generated.get(i);
System.out.println("KeyBinding : " + p.getKeyBinding().getType());
EncryptionPolicy.FeatureBinding f1 = (EncryptionPolicy.FeatureBinding)p.getFeatureBinding();
List<Target> t1 = f1.getTargetBindings();
System.out.println("No of Targets : " + t1.size());
for ( Target t : t1 ) {
System.out.println(t.getType() + " " + t.getValue());
}
}
}
|
protected void | setUp()
|
public static junit.framework.Test | suite()
TestSuite suite = new TestSuite(XWSSPolicyContainerTest.class);
return suite;
|
protected void | tearDown()
|
public void | testXWSSPolicyContainer1()
XWSSPolicyContainer container = new XWSSPolicyContainer(false, false);
SignaturePolicy sigPolicy = new SignaturePolicy();
SignatureTarget t = new SignatureTarget();
t.setType("uri");
t.setValue("sig1");
SignaturePolicy.FeatureBinding featureBinding =
(SignaturePolicy.FeatureBinding)sigPolicy.getFeatureBinding();
featureBinding.addTargetBinding(t);
((AuthenticationTokenPolicy.X509CertificateBinding)sigPolicy.newX509CertificateKeyBinding()).setReferenceType("Direct");
EncryptionPolicy encPolicy = new EncryptionPolicy();
EncryptionTarget t1 = new EncryptionTarget();
t.setType("uri");
t.setValue("enc1");
EncryptionPolicy.FeatureBinding featureBinding1 =
(EncryptionPolicy.FeatureBinding)encPolicy.getFeatureBinding();
featureBinding1.addTargetBinding(t1);
((AuthenticationTokenPolicy.X509CertificateBinding)encPolicy.newX509CertificateKeyBinding()).setReferenceType("Direct");
TimestampPolicy tp = new TimestampPolicy();
AuthenticationTokenPolicy atp = new AuthenticationTokenPolicy();
AuthenticationTokenPolicy.UsernameTokenBinding ut =
new AuthenticationTokenPolicy.UsernameTokenBinding();
atp.setFeatureBinding(ut);
container.setMessageMode(false, false);
container.setPolicyContainerMode(MessageLayout.Lax);
container.insert(sigPolicy);
container.insert(encPolicy);
container.insert(tp);
container.insert(atp);
print(container.getMessagePolicy());
System.out.println("\n\n\n-------------------------\n");
|
public void | testXWSSPolicyContainer2()
XWSSPolicyContainer container = new XWSSPolicyContainer(false, true);
SignaturePolicy sigPolicy = new SignaturePolicy();
SignatureTarget t = new SignatureTarget();
t.setType("uri");
t.setValue("sig1");
SignaturePolicy.FeatureBinding featureBinding =
(SignaturePolicy.FeatureBinding)sigPolicy.getFeatureBinding();
featureBinding.addTargetBinding(t);
((AuthenticationTokenPolicy.X509CertificateBinding)sigPolicy.newX509CertificateKeyBinding()).setReferenceType("Direct");
EncryptionPolicy encPolicy = new EncryptionPolicy();
EncryptionTarget t1 = new EncryptionTarget();
t.setType("uri");
t.setValue("enc1");
EncryptionPolicy.FeatureBinding featureBinding1 =
(EncryptionPolicy.FeatureBinding)encPolicy.getFeatureBinding();
featureBinding1.addTargetBinding(t1);
((AuthenticationTokenPolicy.X509CertificateBinding)encPolicy.newX509CertificateKeyBinding()).setReferenceType("Direct");
TimestampPolicy tp = new TimestampPolicy();
AuthenticationTokenPolicy atp = new AuthenticationTokenPolicy();
AuthenticationTokenPolicy.UsernameTokenBinding ut =
new AuthenticationTokenPolicy.UsernameTokenBinding();
atp.setFeatureBinding(ut);
container.setMessageMode(false, true);
container.setPolicyContainerMode(MessageLayout.Lax);
container.insert(sigPolicy);
container.insert(encPolicy);
container.insert(tp);
container.insert(atp);
print(container.getMessagePolicy());
System.out.println("\n\n\n-------------------------\n");
|
public void | testXWSSPolicyContainer3()
XWSSPolicyContainer container = new XWSSPolicyContainer(true, false);
SignaturePolicy sigPolicy = new SignaturePolicy();
SignatureTarget t = new SignatureTarget();
t.setType("uri");
t.setValue("sig1");
SignaturePolicy.FeatureBinding featureBinding =
(SignaturePolicy.FeatureBinding)sigPolicy.getFeatureBinding();
featureBinding.addTargetBinding(t);
((AuthenticationTokenPolicy.X509CertificateBinding)sigPolicy.newX509CertificateKeyBinding()).setReferenceType("Direct");
EncryptionPolicy encPolicy = new EncryptionPolicy();
EncryptionTarget t1 = new EncryptionTarget();
t.setType("uri");
t.setValue("enc1");
EncryptionPolicy.FeatureBinding featureBinding1 =
(EncryptionPolicy.FeatureBinding)encPolicy.getFeatureBinding();
featureBinding1.addTargetBinding(t1);
((AuthenticationTokenPolicy.X509CertificateBinding)encPolicy.newX509CertificateKeyBinding()).setReferenceType("Direct");
TimestampPolicy tp = new TimestampPolicy();
AuthenticationTokenPolicy atp = new AuthenticationTokenPolicy();
AuthenticationTokenPolicy.UsernameTokenBinding ut =
new AuthenticationTokenPolicy.UsernameTokenBinding();
atp.setFeatureBinding(ut);
container.setMessageMode(true, false);
container.setPolicyContainerMode(MessageLayout.Lax);
container.insert(sigPolicy);
container.insert(encPolicy);
container.insert(tp);
container.insert(atp);
print(container.getMessagePolicy());
System.out.println("\n\n\n-------------------------\n");
|
public void | testXWSSPolicyContainer4()
XWSSPolicyContainer container = new XWSSPolicyContainer(true, true);
SignaturePolicy sigPolicy = new SignaturePolicy();
SignatureTarget t = new SignatureTarget();
t.setType("uri");
t.setValue("sig1");
SignaturePolicy.FeatureBinding featureBinding =
(SignaturePolicy.FeatureBinding)sigPolicy.getFeatureBinding();
featureBinding.addTargetBinding(t);
((AuthenticationTokenPolicy.X509CertificateBinding)sigPolicy.newX509CertificateKeyBinding()).setReferenceType("Direct");
EncryptionPolicy encPolicy = new EncryptionPolicy();
EncryptionTarget t1 = new EncryptionTarget();
t.setType("uri");
t.setValue("enc1");
EncryptionPolicy.FeatureBinding featureBinding1 =
(EncryptionPolicy.FeatureBinding)encPolicy.getFeatureBinding();
featureBinding1.addTargetBinding(t1);
((AuthenticationTokenPolicy.X509CertificateBinding)encPolicy.newX509CertificateKeyBinding()).setReferenceType("Direct");
TimestampPolicy tp = new TimestampPolicy();
AuthenticationTokenPolicy atp = new AuthenticationTokenPolicy();
AuthenticationTokenPolicy.UsernameTokenBinding ut =
new AuthenticationTokenPolicy.UsernameTokenBinding();
atp.setFeatureBinding(ut);
container.setMessageMode(true, true);
container.setPolicyContainerMode(MessageLayout.Lax);
container.insert(sigPolicy);
container.insert(encPolicy);
container.insert(tp);
container.insert(atp);
print(container.getMessagePolicy());
System.out.println("\n\n\n-------------------------\n");
|