Package org.apache.ws.sandbox.security.trust.message.token

Examples of org.apache.ws.sandbox.security.trust.message.token.RequestedProofToken


            stRes = new RequestSecurityTokenResponse(eleSTRes, true);
            SecurityContextToken SCT =
                stRes.getRequestedSecurityToken().getSct();
            uuid = SCT.getIdentifier();
            RequestedProofToken proofToken = stRes.getRequestedProofToken();
            //TODO:: romove the hard coded decryption

            proofToken.doDecryption(callback, this.loadDecryptionCrypto());

            SecurityContextInfo scInfo = null;
            scInfo = new SecurityContextInfo(SCT, proofToken, 1);

            dkcbHandler.addSecurtiyContext(uuid, scInfo);
View Full Code Here


        stRes.build(doc);
        isSCTavailabe = true;

        //Now encrypting with the base token
        RequestedProofToken reqProof = stRes.getRequestedProofToken();

        try {
            reqProof.doEncryptProof(doc, this.serverCrypto, this.serverAlias);

            SecurityContextInfo info =
                new SecurityContextInfo(
                    stRes.getRequestedSecurityToken().getSct(),
                    reqProof,
View Full Code Here

//                "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(
                            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);
View Full Code Here

            stRes = new RequestSecurityTokenResponse(eleSTRes, true);
            SecurityContextToken SCT =
                stRes.getRequestedSecurityToken().getSct();
            uuid = SCT.getIdentifier();
            RequestedProofToken proofToken = stRes.getRequestedProofToken();
            //TODO:: romove the hard coded decryption

            proofToken.doDecryption(callback, this.loadDecryptionCrypto());

            SecurityContextInfo scInfo = null;
            scInfo = new SecurityContextInfo(SCT, proofToken, 1);

            dkcbHandler.addSecurtiyContext(uuid, scInfo);
View Full Code Here

        stRes.build(doc);
        isSCTavailabe = true;

        //Now encrypting with the base token
        RequestedProofToken reqProof = stRes.getRequestedProofToken();

        try {
            reqProof.doEncryptProof(doc, this.serverCrypto, this.serverAlias);

            SecurityContextInfo info =
                new SecurityContextInfo(
                    stRes.getRequestedSecurityToken().getSct(),
                    reqProof,
View Full Code Here

//                "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);
View Full Code Here

TOP

Related Classes of org.apache.ws.sandbox.security.trust.message.token.RequestedProofToken

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.