Package org.fcrepo.server.security.xacml.pep

Examples of org.fcrepo.server.security.xacml.pep.PEPException


        try {
            TransformerFactory xFactory = TransformerFactory.newInstance();
            xFormer = xFactory.newTransformer();
        } catch (TransformerConfigurationException tce) {
            throw new PEPException("Error initialising SearchFilter", tce);
        }

        tidy = new Tidy();
        tidy.setShowWarnings(false);
        tidy.setQuiet(true);
View Full Code Here


                        .toArray(new String[requests.size()]));
        ResponseCtx resCtx;
        try {
            resCtx = m_contextUtil.makeResponseCtx(response);
        } catch (MelcoeXacmlException e) {
            throw new PEPException(e);
        }

        @SuppressWarnings("unchecked")
        Set<Result> results = resCtx.getResults();
View Full Code Here

                        .toArray(new String[requests.size()]));
        ResponseCtx resCtx;
        try {
            resCtx = m_contextUtil.makeResponseCtx(response);
        } catch (MelcoeXacmlException e) {
            throw new PEPException(e);
        }

        @SuppressWarnings("unchecked")
        Set<Result> results = resCtx.getResults();
View Full Code Here

        if(ObjectsFilter.class.isInstance(filter)) { // go find the ObjectHandler
            HttpServletRequest httpRequest = (HttpServletRequest)request;
          filter = this.m_objectsRESTFilterMatcher.getObjectsHandler(httpRequest);
          if (filter == null) {
            logger.error("No FeSL REST objects handler found for \"{}\"", httpRequest.getPathInfo());
            throw new ServletException(new PEPException("No FeSL REST objects handler found for " + servletPath));
          }
        }
        try {
            // handle the request if we have a filter
            if (filter != null) {
                // substitute our own request object that manages parameters
                try {
                    req = new ParameterRequestWrapper((HttpServletRequest) request);
                } catch (Exception e) {
                    throw new PEPException(e);
                }

                logger.debug("Filtering URI: [{}] with: [{}]" , req.getRequestURI(), filter.getClass().getName());

                if(ResponseHandlingRESTFilter.class.isInstance(filter)) {
                     // substitute our own response object that captures the data
                     res = new DataResponseWrapper(((HttpServletResponse) response));
                    // get a handle for the original OutputStream
                    out = response.getOutputStream();
                    logger.debug("Filtering will include post-processing the response");
                }

                reqCtx = filter.handleRequest(req, res);
                if (reqCtx != null) {
                    resCtx = m_ctxHandler.evaluate(reqCtx);
                    enforce(resCtx);
                }

                // pass the request along to the next chain...
                chain.doFilter(req, res);
            } else {
                // there must always be a filter, even if it is a NOOP
                logger.error("No FeSL REST filter found for \"{}\"", servletPath);
                throw new PEPException("No FeSL REST filter found for " + servletPath);
            }

            if(ResponseHandlingRESTFilter.class.isInstance(filter)) {
              // handle the response if we have a non-null response handling filter
              reqCtx = ((ResponseHandlingRESTFilter)filter).handleResponse(req, res);
View Full Code Here

        // there must always be a handler.
        if (operationHandler == null) {
            logger.error("Missing handler for service/operation: " + service
                    + "/" + operation);
            throw CXFUtility
                    .getFault(new PEPException("Missing handler for service/operation: "
                            + service + "/" + operation));
        }

        RequestCtx reqCtx = null;

        // if we are on the request pathway, outboundProperty == false. True on
        // response pathway
        Boolean outboundProperty =
                (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
        try {
            if (outboundProperty) {
                reqCtx = operationHandler.handleResponse(context);
            } else {
                reqCtx = operationHandler.handleRequest(context);
            }
        } catch (OperationHandlerException ohe) {
            logger.error("Error handling operation: " + operation, ohe);
            throw CXFUtility
                    .getFault(new PEPException("Error handling operation: "
                            + operation, ohe));
        }

        // if handler returns null, then there is no work to do (would have
        // thrown exception if things went wrong).
        if (reqCtx == null) {
            return false;
        }

        // if we have received a requestContext, we need to hand it over to the
        // context handler for resolution.
        ResponseCtx resCtx = null;

        try {
            resCtx = m_ctxHandler.evaluate(reqCtx);
        } catch (PEPException pe) {
            logger.error("Error evaluating request", pe);
            throw CXFUtility
                    .getFault(new PEPException("Error evaluating request (operation: "
                                                       + operation + ")",
                                               pe));
        }

        // TODO: set obligations
View Full Code Here

        try {
            TransformerFactory xFactory = TransformerFactory.newInstance();
            xFormer = xFactory.newTransformer();
        } catch (TransformerConfigurationException tce) {
            throw new PEPException("Error initialising SearchFilter", tce);
        }

        tidy = new Tidy();
        tidy.setShowWarnings(false);
        tidy.setQuiet(true);
View Full Code Here

            Transformer transformer = xFormerFactory.newTransformer();
            m_transformers.put("RDF/XML", transformer);
            m_mimeType.put("RDF/XML", "text/xml");
        } catch (TransformerConfigurationException tce) {
            logger.warn("Error loading the rdfxml2nTriples.xsl stylesheet", tce);
            throw new PEPException("Error loading the rdfxml2nTriples.xsl stylesheet",
                                   tce);
        }

        try {
            String stylesheetLocation =
                    "org/fcrepo/server/security/xacml/pep/rest/filters/rdfxml2nTriples.xsl";
            InputStream stylesheet =
                    this.getClass().getClassLoader()
                            .getResourceAsStream(stylesheetLocation);
            if (stylesheet == null) {
                throw new FileNotFoundException("Could not find file: rdfxml2nTriples.xsl");
            }

            Transformer transformer =
                    xFormerFactory.newTransformer(new StreamSource(stylesheet));
            m_transformers.put("N-Triples", transformer);
            m_mimeType.put("N-Triples", "text/plain");
        } catch (TransformerConfigurationException tce) {
            logger.warn("Error loading the rdfxml2n3.xsl stylesheet", tce);
            throw new PEPException("Error loading the rdfxml2n3.xsl stylesheet",
                                   tce);
        } catch (FileNotFoundException fnfe) {
            logger.warn(fnfe.getMessage());
            throw new PEPException(fnfe.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.fcrepo.server.security.xacml.pep.PEPException

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.