Package org.apache.ws.security.processor

Examples of org.apache.ws.security.processor.Processor


                //
                // Call the processor for this token. After the processor returns,
                // store it for later retrieval. The token processor may store some
                // information about the processed token
                //
                Processor p = cfg.getProcessor(el);
                if (p != null) {
                    List<WSSecurityEngineResult> results =
                        p.handleToken((Element) node, requestData, wsDocInfo);
                    returnResults.addAll(0, results);
                } else {
                    if (doDebug) {
                        log.debug(
                            "Unknown Element: " + node.getLocalName() + " " + node.getNamespaceURI()
View Full Code Here


       
        if (id == null) {
            return null;
        }

        Processor p = null;
        if (processors != null) {
            for (Enumeration e = processors.elements(); e.hasMoreElements();) {
                p = (Processor) e.nextElement();
                String cId = p.getId();
                if (id.equals(cId)) {
                    return p;
                }
            }
        }
View Full Code Here

            if (secretKey == null) {
                Element token =
                    secRef.getTokenElement(strElement.getOwnerDocument(), wsDocInfo, data.getCallbackHandler());
                QName el = new QName(token.getNamespaceURI(), token.getLocalName());
                if (el.equals(WSSecurityEngine.BINARY_TOKEN)) {
                    Processor proc = data.getWssConfig().getProcessor(WSSecurityEngine.BINARY_TOKEN);
                    List<WSSecurityEngineResult> bstResult =
                            proc.handleToken(token, data, wsDocInfo);
                    BinarySecurity bstToken =
                            (BinarySecurity)bstResult.get(0).get(WSSecurityEngineResult.TAG_BINARY_SECURITY_TOKEN);
                    if (bspCompliant) {
                        BSPEnforcer.checkBinarySecurityBSPCompliance(secRef, bstToken);
                    }
View Full Code Here

            if (secretKey == null) {
                Element token =
                    secRef.getTokenElement(strElement.getOwnerDocument(), wsDocInfo, data.getCallbackHandler());
                QName el = new QName(token.getNamespaceURI(), token.getLocalName());
                if (el.equals(WSSecurityEngine.BINARY_TOKEN)) {
                    Processor proc = data.getWssConfig().getProcessor(WSSecurityEngine.BINARY_TOKEN);
                    List<WSSecurityEngineResult> bstResult =
                        proc.handleToken(token, data, wsDocInfo);
                    BinarySecurity bstToken =
                        (BinarySecurity)bstResult.get(0).get(WSSecurityEngineResult.TAG_BINARY_SECURITY_TOKEN);
                    if (bspCompliant) {
                        BSPEnforcer.checkBinarySecurityBSPCompliance(secRef, bstToken);
                    }
                    certs = (X509Certificate[])bstResult.get(0).get(WSSecurityEngineResult.TAG_X509_CERTIFICATES);
                    secretKey = (byte[])bstResult.get(0).get(WSSecurityEngineResult.TAG_SECRET);
                    principal = (Principal)bstResult.get(0).get(WSSecurityEngineResult.TAG_PRINCIPAL);
                } else if (el.equals(WSSecurityEngine.SAML_TOKEN)
                    || el.equals(WSSecurityEngine.SAML2_TOKEN)) {
                    Processor proc = data.getWssConfig().getProcessor(WSSecurityEngine.SAML_TOKEN);
                    //
                    // Just check to see whether the token was processed or not
                    //
                    Element processedToken =
                        secRef.findProcessedTokenElement(
                            strElement.getOwnerDocument(), wsDocInfo,
                            data.getCallbackHandler(), uri, secRef.getReference().getValueType()
                        );
                    AssertionWrapper assertion = null;
                    if (processedToken == null) {
                        List<WSSecurityEngineResult> samlResult =
                            proc.handleToken(token, data, wsDocInfo);
                        assertion =
                            (AssertionWrapper)samlResult.get(0).get(
                                WSSecurityEngineResult.TAG_SAML_ASSERTION
                            );
                    } else {
                        assertion = new AssertionWrapper(processedToken);
                        assertion.parseHOKSubject(data, wsDocInfo);
                    }
                    if (bspCompliant) {
                        BSPEnforcer.checkSamlTokenBSPCompliance(secRef, assertion);
                    }
                    SAMLKeyInfo keyInfo = assertion.getSubjectKeyInfo();
                    X509Certificate[] foundCerts = keyInfo.getCerts();
                    if (foundCerts != null && foundCerts.length > 0) {
                        certs = new X509Certificate[]{foundCerts[0]};
                    }
                    secretKey = keyInfo.getSecret();
                    principal = createPrincipalFromSAML(assertion);
                } else if (el.equals(WSSecurityEngine.ENCRYPTED_KEY)) {
                    if (bspCompliant) {
                        BSPEnforcer.checkEncryptedKeyBSPCompliance(secRef);
                    }
                    Processor proc = data.getWssConfig().getProcessor(WSSecurityEngine.ENCRYPTED_KEY);
                    List<WSSecurityEngineResult> encrResult =
                        proc.handleToken(token, data, wsDocInfo);
                    secretKey =
                        (byte[])encrResult.get(0).get(WSSecurityEngineResult.TAG_SECRET);
                    principal = new CustomTokenPrincipal(token.getAttribute("Id"));
                }
            }
View Full Code Here

            if (token == null) {
                throw new WSSecurityException(
                    WSSecurityException.FAILURE, "invalidSAMLsecurity"
                );
            }
            Processor proc = request.getWssConfig().getProcessor(WSSecurityEngine.SAML_TOKEN);
            List<WSSecurityEngineResult> samlResult =
                proc.handleToken(token, request, wsDocInfo);
            return
                (AssertionWrapper)samlResult.get(0).get(
                    WSSecurityEngineResult.TAG_SAML_ASSERTION
                );
        }
View Full Code Here

            QName el = new QName(token.getNamespaceURI(), token.getLocalName());
            if (el.equals(WSSecurityEngine.BINARY_TOKEN)) {
                certs = getCertificatesTokenReference(secRef, token, crypto, bspCompliant);
            } else if (el.equals(WSSecurityEngine.SAML_TOKEN)
                || el.equals(WSSecurityEngine.SAML2_TOKEN)) {
                Processor proc = data.getWssConfig().getProcessor(WSSecurityEngine.SAML_TOKEN);
                //
                // Just check to see whether the token was processed or not
                //
                Element processedToken =
                    secRef.findProcessedTokenElement(
                        strElement.getOwnerDocument(), wsDocInfo,
                        data.getCallbackHandler(), uri, secRef.getReference().getValueType()
                    );
                AssertionWrapper assertion = null;
                if (processedToken == null) {
                    List<WSSecurityEngineResult> samlResult =
                        proc.handleToken(token, data, wsDocInfo);
                    assertion =
                        (AssertionWrapper)samlResult.get(0).get(
                            WSSecurityEngineResult.TAG_SAML_ASSERTION
                        );
                } else {
                    assertion = new AssertionWrapper(processedToken);
                    assertion.parseHOKSubject(data, wsDocInfo);
                }
                if (bspCompliant) {
                    BSPEnforcer.checkSamlTokenBSPCompliance(secRef, assertion);
                }
                SAMLKeyInfo keyInfo = assertion.getSubjectKeyInfo();
                X509Certificate[] foundCerts = keyInfo.getCerts();
                if (foundCerts != null) {
                    certs = new X509Certificate[]{foundCerts[0]};
                }
                secretKey = keyInfo.getSecret();
                principal = createPrincipalFromSAML(assertion);
            } else if (el.equals(WSSecurityEngine.ENCRYPTED_KEY)) {
                if (bspCompliant) {
                    BSPEnforcer.checkEncryptedKeyBSPCompliance(secRef);
                }
                Processor proc = data.getWssConfig().getProcessor(WSSecurityEngine.ENCRYPTED_KEY);
                List<WSSecurityEngineResult> encrResult =
                    proc.handleToken(token, data, wsDocInfo);
                secretKey =
                    (byte[])encrResult.get(0).get(
                                                  WSSecurityEngineResult.TAG_SECRET
                    );
                principal = new CustomTokenPrincipal(token.getAttribute("Id"));
View Full Code Here

            if (elem.getNodeType() != Node.ELEMENT_NODE) {
                continue;
            }
            QName el = new QName(elem.getNamespaceURI(), elem.getLocalName());
            final WSSConfig cfg = getWssConfig();
            Processor p = cfg.getProcessor(el);
            /*
             * Call the processor for this token. After the processor returns,
             * store it for later retrieval. The token processor may store some
             * information about the processed token
             */
            if (p != null) {
                p.handleToken((Element) elem, sigCrypto, decCrypto, cb, wsDocInfo, returnResults, cfg, requestData);
                wsDocInfo.setProcessor(p);
            } else {
                /*
                 * Add check for a BinarySecurityToken, add info to WSDocInfo. If BST is
                 * found before a Signature token this would speed up (at least a little
View Full Code Here

            elem = list.item(i);
            if (elem.getNodeType() != Node.ELEMENT_NODE) {
                continue;
            }
            QName el = new QName(elem.getNamespaceURI(), elem.getLocalName());
            Processor p = wssConfig.getProcessor(el);
            /*
             * Call the processor for this token. After the processor returns,
             * store it for later retrival. The token processor may store some
             * information about the processed token
             */
            if (p != null) {
                p.handleToken((Element) elem, sigCrypto, decCrypto, cb, wsDocInfo, returnResults, wssConfig);
                wsDocInfo.setProcessor(p);
            } else {
                /*
                * Add check for a BinarySecurityToken, add info to WSDocInfo. If BST is
                * found before a Signature token this would speed up (at least a little
View Full Code Here

     
      if (id == null) {
        return null;
      }

      Processor p = null;
        if (processors != null) {
            for (Enumeration e = processors.elements(); e.hasMoreElements();) {
                p = (Processor) e.nextElement();
                String cId = p.getId();
                if (id.equals(cId)) {
                    break;
                }
            }
        }
View Full Code Here

            if (elem.getNodeType() != Node.ELEMENT_NODE) {
                continue;
            }
            QName el = new QName(elem.getNamespaceURI(), elem.getLocalName());
            final WSSConfig cfg = getWssConfig();
            Processor p = cfg.getProcessor(el);
            /*
             * Call the processor for this token. After the processor returns,
             * store it for later retrival. The token processor may store some
             * information about the processed token
             */
            if (p != null) {
                p.handleToken((Element) elem, sigCrypto, decCrypto, cb, wsDocInfo, returnResults, cfg);
                wsDocInfo.setProcessor(p);
            } else {
                /*
                * Add check for a BinarySecurityToken, add info to WSDocInfo. If BST is
                * found before a Signature token this would speed up (at least a little
View Full Code Here

TOP

Related Classes of org.apache.ws.security.processor.Processor

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.