Package com.sun.xacml.ctx

Examples of com.sun.xacml.ctx.RequestCtx


        //check access to the method
        try {
            final ExistPDP pdp = context.getPDP();
            if(pdp != null) {
                final RequestCtx request = pdp.getRequestHelper().createFunctionRequest(context, null, getName());
                //if request is null, this function belongs to a main module and is allowed to be called
                //otherwise, the access must be checked
                if(request != null) {
                    pdp.evaluate(request);
                }
View Full Code Here


    final QName functionName = function.getName();
    //check access to the method
    try {
      final ExistPDP pdp = getContext().getPDP();
      if(pdp != null) {
        final RequestCtx request = pdp.getRequestHelper().createFunctionRequest(context, null, functionName);
        if(request != null)
          {pdp.evaluate(request);}
      }
    } catch (final PermissionDeniedException pde) {
      throw new XPathException(function, "Access to function '" + functionName + "'  denied.", pde);
View Full Code Here

                    logger.debug("context index set={}", contextIndex);
                    Set<Subject> subjects = wrapSubjects(subjectId);
                    Set<Attribute> actions = wrapActions(action, api, contextIndex);
                    Set<Attribute> resources = wrapResources(pid, namespace);

                    RequestCtx request =
                            new RequestCtx(subjects,
                                           resources,
                                           actions,
                                           Collections.EMPTY_SET);
                    Iterator<Attribute> tempit = actions.iterator();
                    while (tempit.hasNext()) {
View Full Code Here

     */
    @Override
    public String evaluate(String request) throws EvaluationException {
        logger.debug("evaluating request: {}", request);

        RequestCtx req = null;
        ByteArrayInputStream is = new ByteArrayInputStream(request.getBytes());

        try {
            req = RequestCtx.getInstance(is);
        } catch (ParsingException pe) {
View Full Code Here

            throws MelcoeXacmlException {
        if (logger.isDebugEnabled()) {
            logger.debug("Building request!");
        }

        RequestCtx request = null;

        // Create the new Request.
        // Note that the Environment must be specified using a valid Set, even
        // if that Set is empty
        try {
            request =
                    new RequestCtx(setupSubjects(subjects),
                                   setupResources(resources, relationshipResolver),
                                   setupAction(actions),
                                   setupEnvironment(environment));
        } catch (Exception e) {
            logger.error("Error creating request.", e);
View Full Code Here

     * @return the RequestCtx object
     * @throws MelcoeXacmlException
     */
    public RequestCtx makeRequestCtx(String request)
            throws MelcoeXacmlException {
        RequestCtx reqCtx = null;
        try {
            ByteArrayInputStream is =
                    new ByteArrayInputStream(request.getBytes());
            reqCtx = RequestCtx.getInstance(is);
        } catch (ParsingException pe) {
View Full Code Here

        String reqs = null;

        if (request == null) {
            // RequestCtx req = makeRequest("public", "read",
            // "demo:SmileyBeerGlass");
            RequestCtx req =
                    makeRequest("administrator",
                                "urn:fedora:names:fedora:2.1:action:id-ingestObject",
                                "/coll:accg806/coll:acst305");
            reqs = contextUtil.makeRequestCtx(req);
        } else {
View Full Code Here

    public static Map<URI, AttributeValue> getEnvironment() {
        return new HashMap<URI, AttributeValue>();
    }

    public static RequestCtx makeRequest(String user, String action, String pid) {
        RequestCtx req = null;

        Map<URI, AttributeValue> resAttr = new HashMap<URI, AttributeValue>();
        Map<URI, AttributeValue> actionAttr =
                new HashMap<URI, AttributeValue>();
View Full Code Here

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {
        ctx = new ContextHandlerImpl();
        RequestCtx req;

        long a, b;
        String request;
        String response;

        request =
                "<Request><Subject SubjectCategory=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\"><Attribute AttributeId=\"urn:oasis:names:tc:xacml:1.0:subject:subject-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\"><AttributeValue>fedoraAdmin</AttributeValue></Attribute></Subject><Subject SubjectCategory=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\"><Attribute AttributeId=\"urn:fedora:names:fedora:2.1:subject:loginId\" DataType=\"http://www.w3.org/2001/XMLSchema#string\"><AttributeValue>fedoraAdmin</AttributeValue></Attribute><Attribute AttributeId=\"urn:fedora:names:fedora:2.1:subject:subjectRepresented\" DataType=\"http://www.w3.org/2001/XMLSchema#string\"><AttributeValue>fedoraAdmin</AttributeValue></Attribute></Subject><Resource><Attribute AttributeId=\"urn:fedora:names:fedora:2.1:resource:object:pid\" DataType=\"http://www.w3.org/2001/XMLSchema#string\"><AttributeValue>FedoraRepository</AttributeValue></Attribute><Attribute AttributeId=\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\" DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\"><AttributeValue>FedoraRepository</AttributeValue></Attribute></Resource><Action><Attribute AttributeId=\"urn:fedora:names:fedora:2.1:action:api\" DataType=\"http://www.w3.org/2001/XMLSchema#string\"><AttributeValue>urn:fedora:names:fedora:2.1:action:api-a</AttributeValue></Attribute><Attribute AttributeId=\"urn:fedora:names:fedora:2.1:action:id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\"><AttributeValue>urn:fedora:names:fedora:2.1:action:id-describeRepository</AttributeValue></Attribute></Action></Request>";
        a = System.nanoTime();

        req =
                ctx.buildRequest(getSubjects("nishen"),
                                 getActions(),
                                 getResources().get(0),
                                 getEnvironment());
        response = ctx.evaluate(request);

        b = System.nanoTime();
        req.encode(System.out);

        System.out.println(response);
        System.out.println("Time taken: " + (b - a));
    }
View Full Code Here

        String asOfDateTime = request.getParameter("asOfDateTime");
        if (!isDate(asOfDateTime)) {
            asOfDateTime = null;
        }

        RequestCtx req = null;
        Map<URI, AttributeValue> actions = new HashMap<URI, AttributeValue>();
        Map<URI, AttributeValue> resAttr;
        try {
            String[] parts = getPathParts(request);
            resAttr = ResourceAttributes.getResources(parts);
View Full Code Here

TOP

Related Classes of com.sun.xacml.ctx.RequestCtx

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.