Package org.apache.ws.security.message

Examples of org.apache.ws.security.message.WSSAddUsernameToken


     *
     * @throws java.lang.Exception Thrown when there is any problem in signing or verification
     */
    public void testUsernameTokenDigest() throws Exception {
        SOAPEnvelope envelope = null;
        WSSAddUsernameToken builder = new WSSAddUsernameToken();
        log.info("Before adding UsernameToken PW Digest....");
        Document doc = unsignedEnvelope.getAsDocument();
        Document signedDoc = builder.build(doc, "wernerd", "verySecret");

        /*
         * convert the resulting document into a message first. The toSOAPMessage()
         * method performs the necessary c14n call to properly set up the signed
         * document and convert it into a SOAP message. After that we extract it
View Full Code Here


     *
     * @throws java.lang.Exception Thrown when there is any problem in signing or verification
     */
    public void testUsernameTokenText() throws Exception {
        SOAPEnvelope envelope = null;
        WSSAddUsernameToken builder = new WSSAddUsernameToken();
        builder.setPasswordType(WSConstants.PASSWORD_TEXT);
        log.info("Before adding UsernameToken PW Text....");
        Document doc = unsignedEnvelope.getAsDocument();
        Document signedDoc = builder.build(doc, "wernerd", "verySecret");
        Message signedMsg = (Message) SOAPUtil.toSOAPMessage(signedDoc);
        if (log.isDebugEnabled()) {
            log.debug("Message with UserNameToken PW Text:");
            XMLUtils.PrettyElementToWriter(signedMsg.getSOAPEnvelope().getAsDOM(), new PrintWriter(System.out));
        }
View Full Code Here

TOP

Related Classes of org.apache.ws.security.message.WSSAddUsernameToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.