Java Code Examples for org.apache.cxf.helpers.DOMUtils#getContent()
The following examples show how to use
org.apache.cxf.helpers.DOMUtils#getContent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSTSClient.java From steady with Apache License 2.0 | 6 votes |
protected String findMEXLocation(Element ref) { Element el = DOMUtils.getFirstElement(ref); while (el != null) { if (el.getLocalName().equals("Address") && VersionTransformer.isSupported(el.getNamespaceURI()) && "MetadataReference".equals(ref.getLocalName())) { return DOMUtils.getContent(el); } else { String ad = findMEXLocation(el); if (ad != null) { return ad; } } el = DOMUtils.getNextElement(el); } return null; }
Example 2
Source File: XPathAssert.java From cxf with Apache License 2.0 | 6 votes |
/** * Asser that the text of the xpath node retrieved is equal to the value * specified. * * @param xpath * @param value * @param node */ public static void assertXPathEquals(String xpath, String value, Node node, Map<String, String> namespaces) throws Exception { Object o = createXPath(namespaces).compile(xpath) .evaluate(node, XPathConstants.NODE); if (o instanceof Node) { Node result = (Node)o; String value2 = DOMUtils.getContent(result); Assert.assertEquals(value, value2); return; } o = createXPath(namespaces).compile(xpath) .evaluate(node, XPathConstants.STRING); if (o instanceof String) { Assert.assertEquals(value, o); return; } Assert.fail("No nodes were found for expression: " + xpath + " in document " + writeNodeToString(node)); }
Example 3
Source File: AbstractSTSClient.java From steady with Apache License 2.0 | 6 votes |
protected String findMEXLocation(Element ref) { Element el = DOMUtils.getFirstElement(ref); while (el != null) { if (el.getLocalName().equals("Address") && VersionTransformer.isSupported(el.getNamespaceURI()) && "MetadataReference".equals(ref.getLocalName())) { return DOMUtils.getContent(el); } else { String ad = findMEXLocation(el); if (ad != null) { return ad; } } el = DOMUtils.getNextElement(el); } return null; }
Example 4
Source File: AbstractSTSClient.java From cxf with Apache License 2.0 | 6 votes |
protected String findMEXLocation(Element ref) { Element el = DOMUtils.getFirstElement(ref); while (el != null) { if ("Address".equals(el.getLocalName()) && VersionTransformer.isSupported(el.getNamespaceURI()) && "MetadataReference".equals(ref.getLocalName())) { return DOMUtils.getContent(el); } String ad = findMEXLocation(el); if (ad != null) { return ad; } el = DOMUtils.getNextElement(el); } return null; }
Example 5
Source File: AbstractSTSClient.java From steady with Apache License 2.0 | 6 votes |
protected String getIDFromSTR(Element el) { Element child = DOMUtils.getFirstElement(el); if (child == null) { return null; } QName elName = DOMUtils.getElementQName(child); if (elName.equals(new QName(WSConstants.SIG_NS, "KeyInfo")) || elName.equals(new QName(WSConstants.WSSE_NS, "KeyIdentifier"))) { return DOMUtils.getContent(child); } else if (elName.equals(Reference.TOKEN)) { return child.getAttribute("URI"); } else if (elName.equals(new QName(STSUtils.SCT_NS_05_02, "Identifier")) || elName.equals(new QName(STSUtils.SCT_NS_05_12, "Identifier"))) { return DOMUtils.getContent(child); } return null; }
Example 6
Source File: SourceGenerator.java From cxf with Apache License 2.0 | 5 votes |
private String getDocText(Element el) { Element doc = DOMUtils.getFirstChildWithName(el, getWadlNamespace(), "doc"); if (doc != null) { return DOMUtils.getContent(doc); } return null; }
Example 7
Source File: STSClient.java From steady with Apache License 2.0 | 5 votes |
private String getTokenTypeFromTemplate() { if (template != null && DOMUtils.getFirstElement(template) != null) { Element tl = DOMUtils.getFirstElement(template); while (tl != null) { if ("TokenType".equals(tl.getLocalName())) { return DOMUtils.getContent(tl); } tl = DOMUtils.getNextElement(tl); } } return null; }
Example 8
Source File: SpnegoContextTokenInInterceptor.java From steady with Apache License 2.0 | 5 votes |
private SpnegoTokenContext handleBinaryExchange( Element binaryExchange, Message message, String namespace ) throws Exception { if (binaryExchange == null) { throw new Exception("No BinaryExchange element received"); } String encoding = binaryExchange.getAttributeNS(null, "EncodingType"); if (!BinarySecurity.BASE64_ENCODING.equals(encoding)) { throw new Exception("Unknown encoding type: " + encoding); } String valueType = binaryExchange.getAttributeNS(null, "ValueType"); if (!(namespace + "/spnego").equals(valueType)) { throw new Exception("Unknown value type: " + valueType); } String content = DOMUtils.getContent(binaryExchange); byte[] decodedContent = Base64.decode(content); String jaasContext = (String)message.getContextualProperty(SecurityConstants.KERBEROS_JAAS_CONTEXT_NAME); String kerberosSpn = (String)message.getContextualProperty(SecurityConstants.KERBEROS_SPN); CallbackHandler callbackHandler = NegotiationUtils.getCallbackHandler( message.getContextualProperty(SecurityConstants.CALLBACK_HANDLER), this.getClass() ); SpnegoTokenContext spnegoToken = new SpnegoTokenContext(); spnegoToken.validateServiceTicket( jaasContext, callbackHandler, kerberosSpn, decodedContent ); return spnegoToken; }
Example 9
Source File: OperationExecutionSOAPRequestInInterceptor.java From kieker with Apache License 2.0 | 5 votes |
private final String getStringContentFromHeader(final Header hdr) { if (hdr == null) { return null; } if (hdr.getObject() instanceof Element) { final Element e = (Element) hdr.getObject(); return DOMUtils.getContent(e); } return null; }
Example 10
Source File: AbstractSTSClient.java From steady with Apache License 2.0 | 5 votes |
protected byte[] decryptKey(Element child) throws TrustException, WSSecurityException { String encryptionAlgorithm = X509Util.getEncAlgo(child); // For the SPNEGO case just return the decoded cipher value and decrypt it later if (encryptionAlgorithm != null && encryptionAlgorithm.endsWith("spnego#GSS_Wrap")) { // Get the CipherValue Element tmpE = WSSecurityUtil.getDirectChildElement(child, "CipherData", WSConstants.ENC_NS); byte[] cipherValue = null; if (tmpE != null) { tmpE = WSSecurityUtil.getDirectChildElement(tmpE, "CipherValue", WSConstants.ENC_NS); if (tmpE != null) { String content = DOMUtils.getContent(tmpE); cipherValue = Base64.decode(content); } } if (cipherValue == null) { throw new WSSecurityException(WSSecurityException.INVALID_SECURITY, "noCipher"); } return cipherValue; } else { try { EncryptedKeyProcessor proc = new EncryptedKeyProcessor(); WSDocInfo docInfo = new WSDocInfo(child.getOwnerDocument()); RequestData data = new RequestData(); data.setWssConfig(WSSConfig.getNewInstance()); data.setDecCrypto(createCrypto(true)); data.setCallbackHandler(createHandler()); List<WSSecurityEngineResult> result = proc.handleToken(child, data, docInfo); return (byte[])result.get(0).get( WSSecurityEngineResult.TAG_SECRET ); } catch (IOException e) { throw new TrustException("ENCRYPTED_KEY_ERROR", LOG, e); } } }
Example 11
Source File: SecurityToken.java From steady with Apache License 2.0 | 5 votes |
public static String getIdFromSTR(Element str) { Element child = DOMUtils.getFirstElement(str); if (child == null) { return null; } if ("KeyInfo".equals(child.getLocalName()) && WSConstants.SIG_NS.equals(child.getNamespaceURI())) { return DOMUtils.getContent(child); } else if (Reference.TOKEN.getLocalPart().equals(child.getLocalName()) && Reference.TOKEN.getNamespaceURI().equals(child.getNamespaceURI())) { return child.getAttribute("URI").substring(1); } return null; }
Example 12
Source File: SimpleBatchSTSClient.java From cxf with Apache License 2.0 | 5 votes |
protected byte[] decryptKey(Element child) throws TrustException, WSSecurityException { String encryptionAlgorithm = X509Util.getEncAlgo(child); // For the SPNEGO case just return the decoded cipher value and decrypt it later if (encryptionAlgorithm != null && encryptionAlgorithm.endsWith("spnego#GSS_Wrap")) { // Get the CipherValue Element tmpE = XMLUtils.getDirectChildElement(child, "CipherData", WSS4JConstants.ENC_NS); byte[] cipherValue = null; if (tmpE != null) { tmpE = XMLUtils.getDirectChildElement(tmpE, "CipherValue", WSS4JConstants.ENC_NS); if (tmpE != null) { String content = DOMUtils.getContent(tmpE); cipherValue = Base64.getMimeDecoder().decode(content); } } if (cipherValue == null) { throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, "noCipher"); } return cipherValue; } try { EncryptedKeyProcessor proc = new EncryptedKeyProcessor(); RequestData data = new RequestData(); data.setWssConfig(WSSConfig.getNewInstance()); data.setDecCrypto(createCrypto(true)); data.setCallbackHandler(createHandler()); WSDocInfo docInfo = new WSDocInfo(child.getOwnerDocument()); data.setWsDocInfo(docInfo); List<WSSecurityEngineResult> result = proc.handleToken(child, data); return (byte[])result.get(0).get( WSSecurityEngineResult.TAG_SECRET ); } catch (IOException e) { throw new TrustException("ENCRYPTED_KEY_ERROR", e, LOG); } }
Example 13
Source File: SpnegoContextTokenInInterceptor.java From steady with Apache License 2.0 | 5 votes |
private SpnegoTokenContext handleBinaryExchange( Element binaryExchange, Message message, String namespace ) throws Exception { if (binaryExchange == null) { throw new Exception("No BinaryExchange element received"); } String encoding = binaryExchange.getAttributeNS(null, "EncodingType"); if (!BinarySecurity.BASE64_ENCODING.equals(encoding)) { throw new Exception("Unknown encoding type: " + encoding); } String valueType = binaryExchange.getAttributeNS(null, "ValueType"); if (!(namespace + "/spnego").equals(valueType)) { throw new Exception("Unknown value type: " + valueType); } String content = DOMUtils.getContent(binaryExchange); byte[] decodedContent = Base64.decode(content); String jaasContext = (String)message.getContextualProperty(SecurityConstants.KERBEROS_JAAS_CONTEXT_NAME); String kerberosSpn = (String)message.getContextualProperty(SecurityConstants.KERBEROS_SPN); CallbackHandler callbackHandler = NegotiationUtils.getCallbackHandler( message.getContextualProperty(SecurityConstants.CALLBACK_HANDLER), this.getClass() ); SpnegoTokenContext spnegoToken = new SpnegoTokenContext(); spnegoToken.validateServiceTicket( jaasContext, callbackHandler, kerberosSpn, decodedContent ); return spnegoToken; }
Example 14
Source File: AbstractSTSClient.java From steady with Apache License 2.0 | 4 votes |
/** * Make an "Renew" invocation and return the response as a STSResponse Object */ public STSResponse renew(SecurityToken tok) throws Exception { createClient(); BindingOperationInfo boi = findOperation("/RST/Renew"); client.getRequestContext().putAll(ctx); if (isSecureConv) { client.getRequestContext().put(SoapBindingConstants.SOAP_ACTION, namespace + "/RST/SCT/Renew"); } else { client.getRequestContext().put(SoapBindingConstants.SOAP_ACTION, namespace + "/RST/Renew"); } W3CDOMStreamWriter writer = new W3CDOMStreamWriter(); writer.writeStartElement("wst", "RequestSecurityToken", namespace); writer.writeNamespace("wst", namespace); if (context != null) { writer.writeAttribute(null, "Context", context); } String sptt = null; if (template != null && DOMUtils.getFirstElement(template) != null) { if (this.useSecondaryParameters()) { writer.writeStartElement("wst", "SecondaryParameters", namespace); } Element tl = DOMUtils.getFirstElement(template); while (tl != null) { StaxUtils.copy(tl, writer); if ("TokenType".equals(tl.getLocalName())) { sptt = DOMUtils.getContent(tl); } tl = DOMUtils.getNextElement(tl); } if (this.useSecondaryParameters()) { writer.writeEndElement(); } } if (isSpnego) { tokenType = STSUtils.getTokenTypeSCT(namespace); } addRequestType("/Renew", writer); if (enableAppliesTo) { addAppliesTo(writer, tok.getIssuerAddress()); } if (sptt == null) { addTokenType(writer); } if (isSecureConv || enableLifetime) { addLifetime(writer); } writer.writeStartElement("wst", "RenewTarget", namespace); client.getRequestContext().put(SecurityConstants.TOKEN, tok); StaxUtils.copy(tok.getToken(), writer); writer.writeEndElement(); writer.writeEndElement(); Object obj[] = client.invoke(boi, new DOMSource(writer.getDocument().getDocumentElement())); return new STSResponse((DOMSource)obj[0], null); }
Example 15
Source File: AbstractSTSClient.java From steady with Apache License 2.0 | 4 votes |
/** * Make an "Renew" invocation and return the response as a STSResponse Object */ public STSResponse renew(SecurityToken tok) throws Exception { createClient(); BindingOperationInfo boi = findOperation("/RST/Renew"); client.getRequestContext().putAll(ctx); if (isSecureConv) { client.getRequestContext().put(SoapBindingConstants.SOAP_ACTION, namespace + "/RST/SCT/Renew"); } else { client.getRequestContext().put(SoapBindingConstants.SOAP_ACTION, namespace + "/RST/Renew"); } W3CDOMStreamWriter writer = new W3CDOMStreamWriter(); writer.writeStartElement("wst", "RequestSecurityToken", namespace); writer.writeNamespace("wst", namespace); if (context != null) { writer.writeAttribute(null, "Context", context); } String sptt = null; if (template != null && DOMUtils.getFirstElement(template) != null) { if (this.useSecondaryParameters()) { writer.writeStartElement("wst", "SecondaryParameters", namespace); } Element tl = DOMUtils.getFirstElement(template); while (tl != null) { StaxUtils.copy(tl, writer); if ("TokenType".equals(tl.getLocalName())) { sptt = DOMUtils.getContent(tl); } tl = DOMUtils.getNextElement(tl); } if (this.useSecondaryParameters()) { writer.writeEndElement(); } } if (isSpnego) { tokenType = STSUtils.getTokenTypeSCT(namespace); } addRequestType("/Renew", writer); if (enableAppliesTo) { addAppliesTo(writer, tok.getIssuerAddress()); } if (sptt == null) { addTokenType(writer); } if (isSecureConv || enableLifetime) { addLifetime(writer); } writer.writeStartElement("wst", "RenewTarget", namespace); client.getRequestContext().put(SecurityConstants.TOKEN, tok); StaxUtils.copy(tok.getToken(), writer); writer.writeEndElement(); writer.writeEndElement(); Object obj[] = client.invoke(boi, new DOMSource(writer.getDocument().getDocumentElement())); return new STSResponse((DOMSource)obj[0], null); }
Example 16
Source File: SimpleBatchSTSClient.java From cxf with Apache License 2.0 | 4 votes |
protected List<SecurityToken> validateBatchSecurityTokens( List<BatchRequest> batchRequestList, String action, String requestType ) throws Exception { createClient(); BindingOperationInfo boi = findOperation("/BatchValidate"); client.getRequestContext().putAll(ctx); client.getRequestContext().put(SoapBindingConstants.SOAP_ACTION, action); W3CDOMStreamWriter writer = new W3CDOMStreamWriter(); writer.writeStartElement("wst", "RequestSecurityTokenCollection", namespace); writer.writeNamespace("wst", namespace); for (BatchRequest batchRequest : batchRequestList) { writer.writeStartElement("wst", "RequestSecurityToken", namespace); writer.writeNamespace("wst", namespace); addRequestType(requestType, writer); addTokenType(writer, batchRequest.getTokenType()); writer.writeStartElement("wst", "ValidateTarget", namespace); Element el = batchRequest.getValidateTarget(); StaxUtils.copy(el, writer); writer.writeEndElement(); writer.writeEndElement(); } writer.writeEndElement(); Object[] obj = client.invoke(boi, new DOMSource(writer.getDocument().getDocumentElement())); Element responseCollection = getDocumentElement((DOMSource)obj[0]); Node child = responseCollection.getFirstChild(); List<SecurityToken> tokens = new ArrayList<>(); while (child != null) { if (child instanceof Element && "RequestSecurityTokenResponse".equals(((Element)child).getLocalName())) { Element rstrChild = DOMUtils.getFirstElement(child); while (rstrChild != null) { if ("Status".equals(rstrChild.getLocalName())) { Element e2 = DOMUtils.getFirstChildWithName(rstrChild, rstrChild.getNamespaceURI(), "Code"); String s = DOMUtils.getContent(e2); if (!s.endsWith("/status/valid")) { throw new TrustException(LOG, "VALIDATION_FAILED"); } } else if ("RequestedSecurityToken".equals(rstrChild.getLocalName())) { Element requestedSecurityTokenElement = DOMUtils.getFirstElement(rstrChild); String id = findID(null, null, requestedSecurityTokenElement); if (StringUtils.isEmpty(id)) { throw new TrustException("NO_ID", LOG); } SecurityToken requestedSecurityToken = new SecurityToken(id); requestedSecurityToken.setToken(requestedSecurityTokenElement); tokens.add(requestedSecurityToken); } rstrChild = DOMUtils.getNextElement(rstrChild); } } child = child.getNextSibling(); } return tokens; }
Example 17
Source File: STSClient.java From steady with Apache License 2.0 | 4 votes |
protected List<SecurityToken> validateSecurityToken(SecurityToken tok, String tokentype) throws Exception { STSResponse response = validate(tok, tokentype); Element el = getDocumentElement(response.getResponse()); if ("RequestSecurityTokenResponseCollection".equals(el.getLocalName())) { el = DOMUtils.getFirstElement(el); } if (!"RequestSecurityTokenResponse".equals(el.getLocalName())) { throw new Fault("Unexpected element " + el.getLocalName(), LOG); } el = DOMUtils.getFirstElement(el); String reason = null; boolean valid = false; List<SecurityToken> tokens = new LinkedList<SecurityToken>(); while (el != null) { if ("Status".equals(el.getLocalName())) { Element e2 = DOMUtils.getFirstChildWithName(el, el.getNamespaceURI(), "Code"); String s = DOMUtils.getContent(e2); valid = s.endsWith("/status/valid"); e2 = DOMUtils.getFirstChildWithName(el, el.getNamespaceURI(), "Reason"); if (e2 != null) { reason = DOMUtils.getContent(e2); } } else if ("RequestedSecurityToken".equals(el.getLocalName())) { Element requestedSecurityTokenElement = DOMUtils.getFirstElement(el); String id = findID(null, null, requestedSecurityTokenElement); if (StringUtils.isEmpty(id)) { throw new TrustException("NO_ID", LOG); } SecurityToken requestedSecurityToken = new SecurityToken(id); requestedSecurityToken.setToken(requestedSecurityTokenElement); tokens.add(requestedSecurityToken); } el = DOMUtils.getNextElement(el); } if (!valid) { throw new TrustException(LOG, "VALIDATION_FAILED", reason); } if (tokens.isEmpty()) { tokens.add(tok); } return tokens; }
Example 18
Source File: AbstractSTSClient.java From cxf with Apache License 2.0 | 4 votes |
/** * Make an "Renew" invocation and return the response as a STSResponse Object */ public STSResponse renew(SecurityToken tok) throws Exception { createClient(); BindingOperationInfo boi = findOperation("/RST/Renew"); client.getRequestContext().putAll(ctx); client.getRequestContext().remove(SecurityConstants.TOKEN_ID); if (isSecureConv) { client.getRequestContext().put(SoapBindingConstants.SOAP_ACTION, namespace + "/RST/SCT/Renew"); } else { client.getRequestContext().put(SoapBindingConstants.SOAP_ACTION, namespace + "/RST/Renew"); } W3CDOMStreamWriter writer = new W3CDOMStreamWriter(); writer.writeStartElement("wst", "RequestSecurityToken", namespace); writer.writeNamespace("wst", namespace); if (context != null) { writer.writeAttribute(null, "Context", context); } String sptt = null; if (template != null && DOMUtils.getFirstElement(template) != null) { if (this.useSecondaryParameters()) { writer.writeStartElement("wst", "SecondaryParameters", namespace); } Element tl = DOMUtils.getFirstElement(template); while (tl != null) { StaxUtils.copy(tl, writer); if ("TokenType".equals(tl.getLocalName())) { sptt = DOMUtils.getContent(tl); } tl = DOMUtils.getNextElement(tl); } if (this.useSecondaryParameters()) { writer.writeEndElement(); } } if (isSpnego) { tokenType = STSUtils.getTokenTypeSCT(namespace); } if (sptt == null) { addTokenType(writer); } addRequestType("/Renew", writer); if (enableAppliesTo) { addAppliesTo(writer, tok.getIssuerAddress()); } if (isSecureConv || enableLifetime) { addLifetime(writer); } writer.writeStartElement("wst", "RenewTarget", namespace); StaxUtils.copy(tok.getToken(), writer); writer.writeEndElement(); // Write out renewal semantics writeRenewalSemantics(writer); writer.writeEndElement(); Object[] obj = client.invoke(boi, new DOMSource(writer.getDocument().getDocumentElement())); @SuppressWarnings("unchecked") Collection<Attachment> attachments = (Collection<Attachment>)client.getResponseContext().get(Message.ATTACHMENTS); return new STSResponse((DOMSource)obj[0], null, null, null, attachments); }
Example 19
Source File: AbstractSTSClient.java From steady with Apache License 2.0 | 4 votes |
/** * Make an "Renew" invocation and return the response as a STSResponse Object */ public STSResponse renew(SecurityToken tok) throws Exception { createClient(); BindingOperationInfo boi = findOperation("/RST/Renew"); client.getRequestContext().putAll(ctx); if (isSecureConv) { client.getRequestContext().put(SoapBindingConstants.SOAP_ACTION, namespace + "/RST/SCT/Renew"); } else { client.getRequestContext().put(SoapBindingConstants.SOAP_ACTION, namespace + "/RST/Renew"); } W3CDOMStreamWriter writer = new W3CDOMStreamWriter(); writer.writeStartElement("wst", "RequestSecurityToken", namespace); writer.writeNamespace("wst", namespace); if (context != null) { writer.writeAttribute(null, "Context", context); } String sptt = null; if (template != null && DOMUtils.getFirstElement(template) != null) { if (this.useSecondaryParameters()) { writer.writeStartElement("wst", "SecondaryParameters", namespace); } Element tl = DOMUtils.getFirstElement(template); while (tl != null) { StaxUtils.copy(tl, writer); if ("TokenType".equals(tl.getLocalName())) { sptt = DOMUtils.getContent(tl); } tl = DOMUtils.getNextElement(tl); } if (this.useSecondaryParameters()) { writer.writeEndElement(); } } if (isSpnego) { tokenType = STSUtils.getTokenTypeSCT(namespace); } addRequestType("/Renew", writer); if (enableAppliesTo) { addAppliesTo(writer, tok.getIssuerAddress()); } if (sptt == null) { addTokenType(writer); } if (isSecureConv || enableLifetime) { addLifetime(writer); } writer.writeStartElement("wst", "RenewTarget", namespace); client.getRequestContext().put(SecurityConstants.TOKEN, tok); StaxUtils.copy(tok.getToken(), writer); writer.writeEndElement(); writer.writeEndElement(); Object obj[] = client.invoke(boi, new DOMSource(writer.getDocument().getDocumentElement())); return new STSResponse((DOMSource)obj[0], null); }
Example 20
Source File: AbstractSTSClient.java From steady with Apache License 2.0 | 4 votes |
/** * Make an "Renew" invocation and return the response as a STSResponse Object */ public STSResponse renew(SecurityToken tok) throws Exception { createClient(); BindingOperationInfo boi = findOperation("/RST/Renew"); client.getRequestContext().putAll(ctx); if (isSecureConv) { client.getRequestContext().put(SoapBindingConstants.SOAP_ACTION, namespace + "/RST/SCT/Renew"); } else { client.getRequestContext().put(SoapBindingConstants.SOAP_ACTION, namespace + "/RST/Renew"); } W3CDOMStreamWriter writer = new W3CDOMStreamWriter(); writer.writeStartElement("wst", "RequestSecurityToken", namespace); writer.writeNamespace("wst", namespace); if (context != null) { writer.writeAttribute(null, "Context", context); } String sptt = null; if (template != null && DOMUtils.getFirstElement(template) != null) { if (this.useSecondaryParameters()) { writer.writeStartElement("wst", "SecondaryParameters", namespace); } Element tl = DOMUtils.getFirstElement(template); while (tl != null) { StaxUtils.copy(tl, writer); if ("TokenType".equals(tl.getLocalName())) { sptt = DOMUtils.getContent(tl); } tl = DOMUtils.getNextElement(tl); } if (this.useSecondaryParameters()) { writer.writeEndElement(); } } if (isSpnego) { tokenType = STSUtils.getTokenTypeSCT(namespace); } addRequestType("/Renew", writer); if (enableAppliesTo) { addAppliesTo(writer, tok.getIssuerAddress()); } if (sptt == null) { addTokenType(writer); } if (isSecureConv || enableLifetime) { addLifetime(writer); } writer.writeStartElement("wst", "RenewTarget", namespace); client.getRequestContext().put(SecurityConstants.TOKEN, tok); StaxUtils.copy(tok.getToken(), writer); writer.writeEndElement(); writer.writeEndElement(); Object obj[] = client.invoke(boi, new DOMSource(writer.getDocument().getDocumentElement())); return new STSResponse((DOMSource)obj[0], null); }