Examples of ProcessingException


Examples of org.apache.cocoon.ProcessingException

    }

    public void setXML(String path, DocumentFragment fragment)
    throws ProcessingException {
        if (this.response == null) {
            throw new ProcessingException("Response Object missing");
        }
        if (path != null) {
            if (path.startsWith("/header/") == true) {
                String name = path.substring(8);
                this.response.setHeader(name, DOMUtil.createText(fragment));
            } else if (path.equals("/cookie") == true) {
                this.response.addCookie(this.createCookie(DOMUtil.createParameters(fragment, null)));
            } else {
                throw new ProcessingException("Invalid response path '"+path+"'");
            }
        }
    }
View Full Code Here

Examples of org.apache.cocoon.ProcessingException

     * method is context specific.
     */
    public void appendXML(String path, DocumentFragment fragment)
    throws ProcessingException {
        if (this.response == null) {
            throw new ProcessingException("Response Object missing");
        }
        if (path != null) {
            if (path.startsWith("/header/") == true) {
                String name = path.substring(8);
                this.response.addHeader(name, DOMUtil.createText(fragment));
            } else if (path.equals("/cookie") == true) {
                this.response.addCookie(this.createCookie(DOMUtil.createParameters(fragment, null)));
            } else {
                throw new ProcessingException("Invalid response path '"+path+"'");
            }
        }

    }
View Full Code Here

Examples of org.apache.cocoon.ProcessingException

    }

    public void removeXML(String path)
    throws ProcessingException {
        throw new ProcessingException("ResponseSessionContext: Removing of xml not allowed");
    }
View Full Code Here

Examples of org.apache.cocoon.ProcessingException

    /**
     * Set a context attribute.
     */
    public void setAttribute(String key, Object value)
    throws ProcessingException {
        throw new ProcessingException("ResponseSessionContext: Setting of attributes not allowed");
    }
View Full Code Here

Examples of org.apache.cocoon.ProcessingException

    /**
     * Get a context attribute.
     */
    public Object getAttribute(String key)
    throws ProcessingException {
        throw new ProcessingException("ResponseSessionContext: Getting of attributes not allowed");
    }
View Full Code Here

Examples of org.apache.cocoon.ProcessingException

    /**
     * Get a context attribute.
     */
    public Object getAttribute(String key, Object defaultObject)
    throws ProcessingException {
        throw new ProcessingException("ResponseSessionContext: Getting of attributes not allowed");
    }
View Full Code Here

Examples of org.apache.cocoon.ProcessingException

    /**
     * Get a copy the first node specified by the path.
     */
    public Node getSingleNode(String path)
    throws ProcessingException {
        throw new ProcessingException("ResponseSessionContext: Getting of xml not allowed");
    }
View Full Code Here

Examples of org.apache.cocoon.pipeline.ProcessingException

        } catch (MalformedURLException e) {
            String message = "Can't parse URL " + sourceAtt;
            if (this.logger.isErrorEnabled()) {
                this.logger.error(message, e);
            }
            throw new ProcessingException(message, e);
        }
    }
View Full Code Here

Examples of org.apache.cxf.fediz.core.exception.ProcessingException

            // PasswordCallbackHandler(password));

            AssertionWrapper assertion = new AssertionWrapper(token);
            if (!assertion.isSigned()) {
                LOG.warn("Assertion is not signed");
                throw new ProcessingException(TYPE.TOKEN_NO_SIGNATURE);
            }
            // Verify the signature
            assertion.verifySignature(requestData,
                    new WSDocInfo(token.getOwnerDocument()));

            // Now verify trust on the signature
            Credential trustCredential = new Credential();
            SAMLKeyInfo samlKeyInfo = assertion.getSignatureKeyInfo();
            trustCredential.setPublicKey(samlKeyInfo.getPublicKey());
            trustCredential.setCertificates(samlKeyInfo.getCerts());
            trustCredential.setAssertion(assertion);

            SamlAssertionValidator trustValidator = new SamlAssertionValidator();
            trustValidator.setFutureTTL(config.getMaximumClockSkew().intValue());
           
            boolean trusted = false;
            String assertionIssuer = assertion.getIssuerString();
           
            List<TrustedIssuer> trustedIssuers = config.getTrustedIssuers();
            for (TrustedIssuer ti : trustedIssuers) {
                List<String> subjectConstraints = Collections.singletonList(ti.getSubject());
                if (ti.getCertificateValidationMethod().equals(CertificateValidationMethod.CHAIN_TRUST)) {
                    trustValidator.setSubjectConstraints(subjectConstraints);
                    trustValidator.setSignatureTrustType(TRUST_TYPE.CHAIN_TRUST_CONSTRAINTS);
                } else if (ti.getCertificateValidationMethod().equals(CertificateValidationMethod.PEER_TRUST)) {
                    trustValidator.setSignatureTrustType(TRUST_TYPE.PEER_TRUST);
                } else {
                    throw new IllegalStateException("Unsupported certificate validation method: "
                                                    + ti.getCertificateValidationMethod());
                }
                try {
                    for (TrustManager tm: config.getCertificateStores()) {
                        try {
                            requestData.setSigCrypto(tm.getCrypto());
                            trustValidator.validate(trustCredential, requestData);
                            trusted = true;
                            break;
                        } catch (Exception ex) {
                            if (LOG.isDebugEnabled()) {
                                LOG.debug("Issuer '" + ti.getName() + "' not validated in keystore '"
                                          + tm.getName() + "'");
                            }
                        }
                    }
                    if (trusted) {
                        break;
                    }
                   
                } catch (Exception ex) {
                    if (LOG.isInfoEnabled()) {
                        LOG.info("Issuer '" + assertionIssuer + "' doesn't match trusted issuer '" + ti.getName()
                                 + "': " + ex.getMessage());
                    }
                }
            }
           
            if (!trusted) {
                // Condition already checked in SamlAssertionValidator
                // Minor performance impact on untrusted and expired tokens
                if (!isConditionValid(assertion, config.getMaximumClockSkew().intValue())) {
                    LOG.warn("Security token expired");
                    throw new ProcessingException(TYPE.TOKEN_EXPIRED);
                } else {
                    LOG.warn("Issuer '" + assertionIssuer + "' not trusted");
                    throw new ProcessingException(TYPE.ISSUER_NOT_TRUSTED);
                }
            }

            String audience = null;
            List<Claim> claims = null;
            if (assertion.getSamlVersion().equals(SAMLVersion.VERSION_20)) {
                claims = parseClaimsInAssertion(assertion.getSaml2());
                audience = getAudienceRestriction(assertion.getSaml2());
            } else if (assertion.getSamlVersion()
                    .equals(SAMLVersion.VERSION_11)) {
                claims = parseClaimsInAssertion(assertion.getSaml1());
                audience = getAudienceRestriction(assertion.getSaml1());
            }

            List<String> roles = null;
            FederationProtocol fp = (FederationProtocol)config.getProtocol();
            if (fp.getRoleURI() != null) {
                URI roleURI = URI.create(fp.getRoleURI());
                String delim = fp.getRoleDelimiter();
                for (Claim c : claims) {
                    if (roleURI.equals(c.getClaimType())) {
                        Object oValue = c.getValue();
                        if (oValue instanceof String) {
                            if (delim == null) {
                                roles = Collections.singletonList((String)oValue);
                            } else {
                                roles = parseRoles((String)oValue, delim);
                            }
                        } else if (oValue instanceof List<?>) {
                            List<String> values = (List<String>)oValue;
                            roles = Collections.unmodifiableList(values);
                        } else {
                            LOG.error("Unsupported value type of Claim value");
                            throw new IllegalStateException("Unsupported value type of Claim value");
                        }
                        claims.remove(c);
                        break;
                    }
                }
            }
           
            SAMLTokenPrincipal p = new SAMLTokenPrincipal(assertion);

            TokenValidatorResponse response = new TokenValidatorResponse(
                    assertion.getId(), p.getName(), assertionIssuer, roles,
                    new ClaimCollection(claims), audience);
            response.setExpires(getExpires(assertion));
           
            return response;

        } catch (WSSecurityException ex) {
            LOG.error("Security token validation failed", ex);
            throw new ProcessingException(TYPE.TOKEN_INVALID);
        }
    }
View Full Code Here

Examples of org.apache.geronimo.jms.test.mdb.exception.ProcessingException

     * @see org.apache.geronimo.jms.test.mdb.MessageReceiver#processMessage(TransferObject)
     */
    @Override
    protected TransferObject processMessage(TransferObject obj) throws ProcessingException {
        if (obj == null) {
            throw new ProcessingException("Object received in message is null");
        } else if (!SimpleTransferObject.class.isInstance(obj)) {
            throw new ProcessingException(MessageFormat.format("Invalid class of object {0} included in received message", obj.getClass()));
        } else {
            SimpleTransferObject to = (SimpleTransferObject) obj;
            to.markProcessed();
            return to;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.