Methods Summary |
---|
private java.io.Reader | getResourceReader(java.lang.String resourceName)
return new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName));
|
protected void | setUp()
|
public static junit.framework.Test | suite()
TestSuite suite = new TestSuite(KerberosTokenTest.class);
return suite;
|
protected void | tearDown()
|
public void | testKerberosTokenAssertions()
testKerberosTokenType("security/KerberosTokenAssertions1.xml", com.sun.xml.ws.security.impl.policy.KerberosToken.WSSKERBEROS_V5_AP_REQ_TOKEN11);
testKerberosTokenType("security/KerberosTokenAssertions2.xml", com.sun.xml.ws.security.impl.policy.KerberosToken.WSSKERBEROS_GSS_V5_AP_REQ_TOKEN11);
testKerberosTokenKeys();
testKerberosTokenReference();
|
public void | testKerberosTokenKeys()
String fileName = "security/KerberosTokenAssertions3.xml";
Policy policy = unmarshalPolicy(fileName);
Iterator <AssertionSet> itr = policy.iterator();
if(itr.hasNext()) {
AssertionSet as = itr.next();
for(PolicyAssertion assertion : as) {
assertEquals("Invalid assertion","KerberosToken",assertion.getName().getLocalPart());
KerberosToken kt = (KerberosToken)assertion;
assertTrue(kt.isRequireDerivedKeys());
}
} else {
throw new Exception("No Assertions found!. Unmarshalling of "+fileName+" failed!");
}
|
public void | testKerberosTokenReference()
String fileName = "security/KerberosTokenAssertions4.xml";
Policy policy = unmarshalPolicy(fileName);
Iterator <AssertionSet> itr = policy.iterator();
if(itr.hasNext()) {
AssertionSet as = itr.next();
for(PolicyAssertion assertion : as) {
assertEquals("Invalid assertion","KerberosToken",assertion.getName().getLocalPart());
KerberosToken kt = (KerberosToken)assertion;
Iterator itrkt = kt.getTokenRefernceType();
if(itr.hasNext()) {
assertTrue(((String)itrkt.next()).equals(com.sun.xml.ws.security.impl.policy.KerberosToken.REQUIRE_KEY_IDENTIFIER_REFERENCE));
}
}
} else {
throw new Exception("No Assertions found!. Unmarshalling of "+fileName+" failed!");
}
|
public void | testKerberosTokenType(java.lang.String fileName, java.lang.String TokenType)
Policy policy = unmarshalPolicy(fileName);
Iterator <AssertionSet> itr = policy.iterator();
if(itr.hasNext()) {
AssertionSet as = itr.next();
for(PolicyAssertion assertion : as) {
assertEquals("Invalid assertion","KerberosToken",assertion.getName().getLocalPart());
KerberosToken kt = (KerberosToken)assertion;
assertTrue(TokenType.equals(kt.getTokenType()));
}
} else {
throw new Exception("No Assertions found!. Unmarshalling of "+fileName+" failed!");
}
|
public com.sun.xml.ws.policy.Policy | unmarshalPolicy(java.lang.String xmlFile)
PolicySourceModel model = unmarshalPolicyResource(
xmlFile);
Policy mbp = PolicyModelTranslator.getTranslator().translate(model);
return mbp;
|
private com.sun.xml.ws.policy.sourcemodel.PolicySourceModel | unmarshalPolicyResource(java.lang.String resource)
Reader reader = getResourceReader(resource);
PolicySourceModel model = PolicyModelUnmarshaller.getXmlUnmarshaller().unmarshalModel(reader);
reader.close();
return model;
|