Package org.apache.ws.security.conversation.message.token

Examples of org.apache.ws.security.conversation.message.token.SecurityContextToken


                        doc.getDocumentElement(),
                        true);
                WSSecurityUtil.appendChildElement(
                    doc,
                    securityHeader,
                    (new SecurityContextToken(doc, uuid)).getElement());
                ConversationManager manager = new ConversationManager();
                for (int i = 0; i < this.actionsInt.length; i++) {
                    // Derrive the token
                    DerivedKeyInfo dkInfo =
                        manager.createDerivedKeyToken(doc, uuid, dkcbHandler,null, keyLen);
View Full Code Here


//            throw new AxisFault(
//                "ConversationClientHandler ::" + e1.getMessage());
//        }

        // We have successfully recieved the message element part.
        SecurityContextToken sct = null;
        RequestedProofToken proof = null;

        log.debug("Trust communitcator successfully completed.");
        try {
            MessageElement tmpEle = null;
            for (int i = 0; i < meArrRes.length; i++) {
                tmpEle = meArrRes[i];
                QName el =
                    new QName(tmpEle.getNamespaceURI(), tmpEle.getLocalName());

                Element domEle = tmpEle.getAsDOM();

                if (el.equals(RequestedSecurityToken.TOKEN)) {
                    log.debug("Recognized RequestedSecurityToken.");

                    NodeList ndList =
                        domEle.getElementsByTagNameNS(
                            SecurityContextToken.TOKEN.getNamespaceURI(),
                            SecurityContextToken.TOKEN.getLocalPart());
                    if (ndList.getLength() < 0) {
                        throw new AxisFault("Unspported yet ..");
                    }
                    sct = new SecurityContextToken((Element) ndList.item(0));

                    SOAPHeader soapHeader = sm.getSOAPHeader();
                    soapHeader.addChildElement(
                        "Security",
                        WSConstants.WSSE_PREFIX,
                        WSConstants.WSSE_NS);

                    Iterator it = soapHeader.getChildElements();
                    while (it.hasNext()) {
                        SOAPHeaderElement shSecElem;
                        if ((shSecElem = (SOAPHeaderElement) it.next())
                            .getLocalName()
                            .equals("Security")) {
                            MessageElement rstr =
                                new MessageElement(
                                    RequestSecurityTokenResponse
                                        .TOKEN
                                        .getLocalPart(),
                                    RequestSecurityTokenResponse
                                        .TOKEN
                                        .getPrefix(),
                                    RequestSecurityTokenResponse
                                        .TOKEN
                                        .getNamespaceURI());
                            rstr.addChild(tmpEle);
                            shSecElem.addChildElement(rstr);
                        }
                    }
                } else if (el.equals(RequestedProofToken.TOKEN)) {
                    SOAPPart sPart =
                        (org.apache.axis.SOAPPart) sm.getSOAPPart();
                    doc =
                        ((org.apache.axis.message.SOAPEnvelope) sPart
                            .getEnvelope())
                            .getAsDocument();
                    //do decrytion - proof is encrypted with certificate of STS
                    proof = new RequestedProofToken(domEle);
            
            
                    proof.doDecryption(callbackHandler, serverCrypto);

                    byte[] bkArr = proof.getSharedSecret();
                    RequestedProofToken newProof = new RequestedProofToken(doc);
                    newProof.setSharedSecret(bkArr);
                    newProof.doEncryptProof(
                        doc,
                        serverCrypto,
                        this.serverAlias);

                    Element secHeader =
                        WSSecurityUtil.findWsseSecurityHeaderBlock(WSSConfig.getDefaultWSConfig(),
                            doc,
                            doc.getDocumentElement(),
                            true);

                    Element ele =
                        (Element) WSSecurityUtil.findElement(
                            secHeader,
                            RequestSecurityTokenResponse.TOKEN.getLocalPart(),
                            RequestSecurityTokenResponse
                                .TOKEN
                                .getNamespaceURI());

                    ele.appendChild(newProof.getElement());

                    ByteArrayOutputStream os = new ByteArrayOutputStream();
                    XMLUtils.outputDOM(doc, os, true);
                    String osStr = os.toString();
                    sPart.setCurrentMessage(osStr, SOAPPart.FORM_STRING);

                }

            } //for loop

            this.initSessionInfo();
            Integer keyFreq =
                (Integer) this.configurator.get(ConvHandlerConstants.KEY_FREQ);
            SecurityContextInfo sctInfo =
                new SecurityContextInfo(sct, proof, keyFreq.intValue());
            this.uuid = sct.getIdentifier();
            dkcbHandler.addSecurtiyContext(uuid, sctInfo);

            Boolean isFixedKey =
                (Boolean) configurator.get(
                    ConvHandlerConstants.USE_FIXED_KEYLEN);
View Full Code Here

                                doc.getDocumentElement(),
                                true);
                WSSecurityUtil.appendChildElement(
                        doc,
                        securityHeader,
                        (new SecurityContextToken(doc, uuid)).getElement());
            }

            ConversationManager manager = new ConversationManager();

            for (int i = 0; i < this.actionsInt.length; i++) {
View Full Code Here

TOP

Related Classes of org.apache.ws.security.conversation.message.token.SecurityContextToken

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.