protected String setWsuId(Element bodyElement) { String id = bodyElement.getAttributeNS(WSConstants.WSU_NS, "Id"); if ((id == null) || (id.length() == 0)) { id = WSSConfig.getDefaultWSConfig().getIdAllocator().createId("id-", bodyElement); String prefix = WSSecurityUtil.setNamespace(bodyElement, WSConstants.WSU_NS, WSConstants.WSU_PREFIX); bodyElement.setAttributeNS(WSConstants.WSU_NS, prefix + ":Id", id); } return id; } }
protected String setWsuId(Element bodyElement) { String id = bodyElement.getAttributeNS(WSConstants.WSU_NS, "Id"); if ((id == null) || (id.length() == 0)) { id = WSSConfig.getNewInstance().getIdAllocator().createId("id-", bodyElement); String prefix = WSSecurityUtil.setNamespace(bodyElement, WSConstants.WSU_NS, WSConstants.WSU_PREFIX); bodyElement.setAttributeNS(WSConstants.WSU_NS, prefix + ":Id", id); } return id; } }
id = wssConfig.getIdAllocator().createId("id-", bodyElement); String prefix = WSSecurityUtil.setNamespace(bodyElement, newAttrNs, newAttrPrefix);
id = wssConfig.getIdAllocator().createId("id-", bodyElement); String prefix = WSSecurityUtil.setNamespace(bodyElement, newAttrNs, newAttrPrefix);
/** * Constructor to create the SCT * * @param doc */ public SecurityContextToken(int version, Document doc) throws ConversationException { String ns = ConversationConstants.getWSCNs(version); element = doc.createElementNS(ns, "wsc:" + ConversationConstants.SECURITY_CONTEXT_TOKEN_LN); WSSecurityUtil.setNamespace(element, ns, ConversationConstants.WSC_PREFIX); elementIdentifier = doc.createElementNS(ns, "wsc:" + ConversationConstants.IDENTIFIER_LN); element.appendChild(elementIdentifier); String uuid = "uuid:" + UUIDGenerator.getUUID(); elementIdentifier.appendChild(doc.createTextNode(uuid)); setID(getWSSConfig().getIdAllocator().createSecureId("sctId-", element)); }
/** * Constructor to create the SCT * * @param doc */ public SecurityContextToken(int version, Document doc) throws ConversationException { String ns = ConversationConstants.getWSCNs(version); element = doc.createElementNS(ns, "wsc:" + ConversationConstants.SECURITY_CONTEXT_TOKEN_LN); WSSecurityUtil.setNamespace(element, ns, ConversationConstants.WSC_PREFIX); elementIdentifier = doc.createElementNS(ns, "wsc:" + ConversationConstants.IDENTIFIER_LN); element.appendChild(elementIdentifier); String uuid = "uuid:" + UUIDGenerator.getUUID(); elementIdentifier.appendChild(doc.createTextNode(uuid)); setID(getWSSConfig().getIdAllocator().createSecureId("sctId-", element)); }
/** * Creates a SignatureConfimation element. * * The method prepares and initializes a WSSec SignatureConfirmation structure after * the relevant information was set. Before calling <code>prepare()</code> the * filed <code>signatureValue</code> must be set * * @param doc The SOAP envelope as W3C document */ public void prepare(Document doc) { sc = new SignatureConfirmation(doc, signatureValue); sc.setID(getWsConfig().getIdAllocator().createId("SC-", sc)); }
config.getIdAllocator().createId("ED-", elementToEncrypt); try { String headerId = ""; String wsuPrefix = WSSecurityUtil.setNamespace(elem, WSConstants.WSU_NS, WSConstants.WSU_PREFIX); headerId = config.getIdAllocator().createId("EH-", elementToEncrypt); elem.setAttributeNS( WSConstants.WSU_NS, wsuPrefix + ":Id", headerId
/** * Creates a SignatureConfimation element. * * The method prepares and initializes a WSSec SignatureConfirmation structure after * the relevant information was set. Before calling <code>prepare()</code> the * filed <code>signatureValue</code> must be set * * @param doc The SOAP envelope as W3C document */ public void prepare(Document doc) { sc = new SignatureConfirmation(doc, signatureValue); sc.setID(getWsConfig().getIdAllocator().createId("SC-", sc)); }
); certUri = getWsConfig().getIdAllocator().createSecureId("X509-", certs[0]);
); certUri = getWsConfig().getIdAllocator().createSecureId("X509-", certs[0]);
/** * Creates a Timestamp element. * * The method prepares and initializes a WSSec Timestamp structure after the * relevant information was set. Before calling <code>prepare()</code> the * parameter such as <code>timeToLive</code> can be set if the default * value is not suitable. * * @param doc The SOAP envelope as W3C document */ public void prepare(Document doc) { ts = new Timestamp(getWsConfig().isPrecisionInMilliSeconds(), doc, getWsConfig().getCurrentTime(), timeToLive); String tsId = getWsConfig().getIdAllocator().createId("TS-", ts); ts.setID(tsId); }
/** * Creates a Timestamp element. * * The method prepares and initializes a WSSec Timestamp structure after the * relevant information was set. Before calling <code>prepare()</code> the * parameter such as <code>timeToLive</code> can be set if the default * value is not suitable. * * @param doc The SOAP envelope as W3C document */ public void prepare(Document doc) { ts = new Timestamp(getWsConfig().isPrecisionInMilliSeconds(), doc, getWsConfig().getCurrentTime(), timeToLive); String tsId = getWsConfig().getIdAllocator().createId("TS-", ts); ts.setID(tsId); }
keyInfoUri = getWsConfig().getIdAllocator().createSecureId("KI-", keyInfo); strUri = getWsConfig().getIdAllocator().createSecureId("STR-", secRef); secRef.setID(strUri);
keyInfoUri = getWsConfig().getIdAllocator().createSecureId("KI-", keyInfo); strUri = getWsConfig().getIdAllocator().createSecureId("STR-", secRef); secRef.setID(strUri);
keyInfo, null, getWsConfig().getIdAllocator().createId("SIG-", null), null);
/** * Creates a Username token. * * The method prepares and initializes a WSSec UsernameToken structure after * the relevant information was set. A Before calling * <code>prepare()</code> all parameters such as user, password, * passwordType etc. must be set. A complete <code>UsernameToken</code> is * constructed. * * @param doc The SOAP envelope as W3C document */ public void prepare(Document doc) { ut = new UsernameToken(getWsConfig().isPrecisionInMilliSeconds(), doc, getWsConfig().getCurrentTime(), passwordType); ut.setPasswordsAreEncoded(passwordsAreEncoded); ut.setName(user); if (useDerivedKey) { saltValue = ut.addSalt(doc, saltValue, useMac); ut.addIteration(doc, iteration); } else { ut.setPassword(password); } if (nonce) { ut.addNonce(doc); } if (created) { ut.addCreated(getWsConfig().isPrecisionInMilliSeconds(), getWsConfig().getCurrentTime(), doc); } ut.setID(getWsConfig().getIdAllocator().createId("UsernameToken-", ut)); }
keyInfo, null, getWsConfig().getIdAllocator().createId("SIG-", null), null);
keyInfo, null, getWsConfig().getIdAllocator().createId("SIG-", null), null);
/** * Creates a Username token. * * The method prepares and initializes a WSSec UsernameToken structure after * the relevant information was set. A Before calling * <code>prepare()</code> all parameters such as user, password, * passwordType etc. must be set. A complete <code>UsernameToken</code> is * constructed. * * @param doc The SOAP envelope as W3C document */ public void prepare(Document doc) { ut = new UsernameToken(getWsConfig().isPrecisionInMilliSeconds(), doc, getWsConfig().getCurrentTime(), passwordType); ut.setPasswordsAreEncoded(passwordsAreEncoded); ut.setName(user); if (useDerivedKey) { saltValue = ut.addSalt(doc, saltValue, useMac); ut.addIteration(doc, iteration); } else { ut.setPassword(password); } if (nonce) { ut.addNonce(doc); } if (created) { ut.addCreated(getWsConfig().isPrecisionInMilliSeconds(), getWsConfig().getCurrentTime(), doc); } ut.setID(getWsConfig().getIdAllocator().createId("UsernameToken-", ut)); }