/** * 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); }
/** * We use this method to prevent the singleton behavior of WSSConfig * @return WSSConfig object with the latest settings. */ public static WSSConfig getWSSConfigInstance() { WSSConfig defaultWssConfig = WSSConfig.getNewInstance(); WSSConfig wssConfig = WSSConfig.getNewInstance(); wssConfig.setEnableSignatureConfirmation(defaultWssConfig.isEnableSignatureConfirmation()); wssConfig.setTimeStampStrict(defaultWssConfig.isTimeStampStrict()); wssConfig.setWsiBSPCompliant(defaultWssConfig.isWsiBSPCompliant()); wssConfig.setPrecisionInMilliSeconds(defaultWssConfig.isPrecisionInMilliSeconds()); return wssConfig; }
/** * 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 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)); }
/** * 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)); }