id = getIdAllocator().createId("id-", bodyElement); String prefix = XMLUtils.setNamespace(bodyElement, newAttrNs, newAttrPrefix); bodyElement.setAttributeNS(newAttrNs, prefix + ":Id", id);
String wsuPrefix = XMLUtils.setNamespace(elem, WSConstants.WSU_NS, WSConstants.WSU_PREFIX); String headerId = idAllocator.createId("EH-", elementToEncrypt); elem.setAttributeNS( WSConstants.WSU_NS, wsuPrefix + ":Id", headerId
String xencEncryptedDataId = idAllocator.createId("ED-", elementToEncrypt); try { if ("Header".equals(modifier)) {
/** * 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 */ public void prepare() { sc = new SignatureConfirmation(getDocument(), signatureValue); sc.setID(getIdAllocator().createId("SC-", sc)); }
/** * 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. */ public void prepare() { ts = new Timestamp(precisionInMilliSeconds, getDocument(), wsTimeSource, timeToLive); String tsId = getIdAllocator().createId("TS-", ts); ts.setID(tsId); }
String encEncryptedDataId = idAllocator.createId("ED-", attachmentId); encDataRef.add("#" + encEncryptedDataId);
} else { id = wssConfig.getIdAllocator().createId("_", elem); String pfx = null; try {
} else { id = wssConfig.getIdAllocator().createId("_", elem); String pfx = null; try {
public void prepare(Crypto crypto) throws WSSecurityException { if (sct == null) { if (identifier != null) { sct = new SecurityContextToken(wscVersion, doc, identifier); } else { sct = new SecurityContextToken(wscVersion, doc); identifier = sct.getIdentifier(); } } // The wsu:Id of the wsc:SecurityContextToken if (sctId == null) { sctId = getWsConfig().getIdAllocator().createId("sctId-", sct); } sct.setID(sctId); }
private SecurityToken getUTDerivedKey() throws WSSecurityException { List<WSHandlerResult> results = CastUtils.cast((List<?>)message.getExchange().getInMessage() .get(WSHandlerConstants.RECV_RESULTS)); for (WSHandlerResult rResult : results) { List<WSSecurityEngineResult> wsSecEngineResults = rResult.getActionResults().get(WSConstants.UT_NOPASSWORD); if (wsSecEngineResults != null) { for (WSSecurityEngineResult wser : wsSecEngineResults) { String utID = (String)wser.get(WSSecurityEngineResult.TAG_ID); if (utID == null || utID.length() == 0) { utID = wssConfig.getIdAllocator().createId("UsernameToken-", null); } Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken securityToken = new SecurityToken(utID, created, expires); byte[] secret = (byte[])wser.get(WSSecurityEngineResult.TAG_SECRET); securityToken.setSecret(secret); return securityToken; } } } return null; }
private SecurityToken getUTDerivedKey() throws WSSecurityException { List<WSHandlerResult> results = CastUtils.cast((List<?>)message.getExchange().getInMessage() .get(WSHandlerConstants.RECV_RESULTS)); for (WSHandlerResult rResult : results) { List<WSSecurityEngineResult> wsSecEngineResults = rResult.getActionResults().get(WSConstants.UT_NOPASSWORD); if (wsSecEngineResults != null) { for (WSSecurityEngineResult wser : wsSecEngineResults) { String utID = (String)wser.get(WSSecurityEngineResult.TAG_ID); if (utID == null || utID.length() == 0) { utID = wssConfig.getIdAllocator().createId("UsernameToken-", null); } Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken securityToken = new SecurityToken(utID, created, expires); byte[] secret = (byte[])wser.get(WSSecurityEngineResult.TAG_SECRET); securityToken.setSecret(secret); return securityToken; } } } return null; }
final String attachmentId = getIdAllocator().createId("", getDocument()); WSSecurityUtil.storeBytesInAttachment(bstToken, getDocument(), attachmentId, certBytes, attachmentCallbackHandler);
ut.setID(config.getIdAllocator().createId("UsernameToken-", ut));
keyInfo, null, getIdAllocator().createId("SIG-", null), null);
keyInfo, null, getIdAllocator().createId("SIG-", null), null);
); WSSConfig wssConfig = WSSConfig.getNewInstance(); sct.setID(wssConfig.getIdAllocator().createId("sctId-", sct));
new SecurityContextToken(getWSCVersion(tokenRequirements.getTokenType()), doc); WSSConfig wssConfig = WSSConfig.getNewInstance(); sct.setID(wssConfig.getIdAllocator().createId("sctId-", sct));
keyInfo, null, 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. */ public void prepare() { ut = new UsernameToken(precisionInMilliSeconds, getDocument(), wsTimeSource, passwordType); ut.setPasswordsAreEncoded(passwordsAreEncoded); ut.setName(user); if (useDerivedKey) { saltValue = ut.addSalt(getDocument(), saltValue, useMac); ut.addIteration(getDocument(), iteration); } else { ut.setPassword(password); } if (nonce) { ut.addNonce(getDocument()); } if (created) { ut.addCreated(precisionInMilliSeconds, wsTimeSource, getDocument()); } ut.setID(getIdAllocator().createId("UsernameToken-", ut)); }