public void testPublicKey() throws Exception {
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
InputStream configStream = tcl.getResourceAsStream("parser/wst/wst-issue-public-key.xml");
WSTrustParser parser = new WSTrustParser();
RequestSecurityToken requestToken = (RequestSecurityToken) parser.parse(configStream);
assertEquals("testcontext", requestToken.getContext());
assertEquals(WSTrustConstants.ISSUE_REQUEST, requestToken.getRequestType().toASCIIString());
AppliesTo appliesTo = requestToken.getAppliesTo();
EndpointReferenceType endpoint = (EndpointReferenceType) appliesTo.getAny().get(0);
assertEquals("http://services.testcorp.org/provider2", endpoint.getAddress().getValue());
assertEquals("http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey", requestToken.getKeyType().toASCIIString());
UseKeyType useKeyType = requestToken.getUseKey();
Element certEl = (Element) useKeyType.getAny().get(0);
assertEquals("ds:" + WSTRequestSecurityTokenParser.KEYVALUE, certEl.getTagName());
// Now for the writing part