Package org.opensaml.xacml.ctx

Examples of org.opensaml.xacml.ctx.RequestType


    }

    /** {@inheritDoc} */
    protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
            throws UnmarshallingException {
        RequestType request = (RequestType) parentXMLObject;

        if (childXMLObject instanceof ActionType) {
            request.setAction((ActionType) childXMLObject);
        } else if (childXMLObject instanceof EnvironmentType) {
            request.setEnvironment((EnvironmentType) childXMLObject);
        } else if (childXMLObject instanceof SubjectType) {
            request.getSubjects().add((SubjectType) childXMLObject);
        } else if (childXMLObject instanceof ResourceType) {
            request.getResources().add((ResourceType) childXMLObject);
        } else {
            super.processChildElement(parentXMLObject, childXMLObject);
        }
    }
View Full Code Here


     * Perform a (remote) authorization decision and return a boolean depending on the result
     */
    protected boolean authorize(
        Principal principal, List<String> roles, Message message
    ) throws Exception {
        RequestType request = requestBuilder.createRequest(principal, roles, message);
        if (LOG.isLoggable(Level.FINE)) {
            Document doc = DOMUtils.createDocument();
            Element requestElement = OpenSAMLUtil.toDom(request, doc);
            LOG.log(Level.FINE, DOM2Writer.nodeToString(requestElement));
        }
View Full Code Here

    ) {
        if (requestTypeBuilder == null) {
            requestTypeBuilder = (XACMLObjectBuilder<RequestType>)
                builderFactory.getBuilder(RequestType.DEFAULT_ELEMENT_NAME);
        }
        RequestType request = requestTypeBuilder.buildObject();
        request.getSubjects().addAll(subjects);
        request.getResources().addAll(resources);
        request.setAction(action);
        request.setEnvironment(environment);
       
        return request;
    }
View Full Code Here

        org.apache.wss4j.common.saml.OpenSAMLUtil.initSamlEngine();
    }
   
    @Override
    public Source evaluate(Source request) {
        RequestType requestType = requestSourceToRequestType(request);
       
        XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
       
        @SuppressWarnings("unchecked")
        XACMLObjectBuilder<ResponseType> responseTypeBuilder =
View Full Code Here

        }
        EnvironmentType environmentType =
            RequestComponentBuilder.createEnvironmentType(attributes);
       
        // Request
        RequestType request =
            RequestComponentBuilder.createRequestType(
                Collections.singletonList(subjectType),
                Collections.singletonList(resourceType),
                actionType,
                environmentType
View Full Code Here

     * Perform a (remote) authorization decision and return a boolean depending on the result
     */
    protected boolean authorize(
        Principal principal, List<String> roles, Message message
    ) throws Exception {
        RequestType request = requestBuilder.createRequest(principal, roles, message);
       
        ResponseType response = performRequest(request, message);
       
        ResultType result = response.getResult();
       
View Full Code Here

        String operation = "{http://www.example.org/contract/DoubleIt}DoubleIt";
        MessageImpl msg = new MessageImpl();
        msg.put(Message.WSDL_OPERATION, operation);
       
        XACMLRequestBuilder builder = new DefaultXACMLRequestBuilder();
        RequestType request =
            builder.createRequest(principal, Collections.singletonList("manager"), msg);
        assertNotNull(request);
    }
View Full Code Here

        String operation = "{http://www.example.org/contract/DoubleIt}DoubleIt";
        MessageImpl msg = new MessageImpl();
        msg.put(Message.WSDL_OPERATION, operation);
       
        XACMLRequestBuilder builder = new DefaultXACMLRequestBuilder();
        RequestType request =
            builder.createRequest(principal, Collections.singletonList("manager"), msg);
        assertNotNull(request);
       
        assertEquals(operation, builder.getResource(msg));
       
View Full Code Here

        String operation = "{http://www.example.org/contract/DoubleIt}DoubleIt";
        MessageImpl msg = new MessageImpl();
        msg.put(Message.WSDL_OPERATION, operation);
       
        XACMLRequestBuilder builder = new DefaultXACMLRequestBuilder();
        RequestType request =
            builder.createRequest(principal, Collections.singletonList("manager"), msg);
        assertNotNull(request);
       
        String action =
            request.getAction().getAttributes().get(0).getAttributeValues().get(0).getValue();
        assertEquals(action, "execute");
       
        ((DefaultXACMLRequestBuilder)builder).setAction("write");
        request = builder.createRequest(principal, Collections.singletonList("manager"), msg);
        assertNotNull(request);
       
        action =
            request.getAction().getAttributes().get(0).getAttributeValues().get(0).getValue();
        assertEquals(action, "write");
    }
View Full Code Here

        String operation = "{http://www.example.org/contract/DoubleIt}DoubleIt";
        MessageImpl msg = new MessageImpl();
        msg.put(Message.WSDL_OPERATION, operation);
       
        XACMLRequestBuilder builder = new DefaultXACMLRequestBuilder();
        RequestType request =
            builder.createRequest(principal, Collections.singletonList("manager"), msg);
        assertNotNull(request);
        assertFalse(request.getEnvironment().getAttributes().isEmpty());
       
        ((DefaultXACMLRequestBuilder)builder).setSendDateTime(false);
        request = builder.createRequest(principal, Collections.singletonList("manager"), msg);
        assertNotNull(request);
        assertTrue(request.getEnvironment().getAttributes().isEmpty());
    }
View Full Code Here

TOP

Related Classes of org.opensaml.xacml.ctx.RequestType

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.