Search in sources :

Example 1 with CXFMessageParser

use of org.apache.cxf.rt.security.saml.xacml.CXFMessageParser in project cxf by apache.

the class DefaultXACMLRequestBuilder method createRequest.

/**
 * Create an XACML Request given a Principal, list of roles and Message.
 */
public RequestType createRequest(Principal principal, List<String> roles, Message message) throws Exception {
    CXFMessageParser messageParser = new CXFMessageParser(message);
    String issuer = messageParser.getIssuer();
    String actionToUse = messageParser.getAction(action);
    SubjectType subjectType = createSubjectType(principal, roles, issuer);
    ResourceType resourceType = createResourceType(messageParser);
    AttributeType actionAttribute = createAttribute(XACMLConstants.ACTION_ID, XACMLConstants.XS_STRING, null, actionToUse);
    ActionType actionType = RequestComponentBuilder.createActionType(Collections.singletonList(actionAttribute));
    return RequestComponentBuilder.createRequestType(Collections.singletonList(subjectType), Collections.singletonList(resourceType), actionType, createEnvironmentType());
}
Also used : CXFMessageParser(org.apache.cxf.rt.security.saml.xacml.CXFMessageParser) SubjectType(org.opensaml.xacml.ctx.SubjectType) ActionType(org.opensaml.xacml.ctx.ActionType) AttributeType(org.opensaml.xacml.ctx.AttributeType) ResourceType(org.opensaml.xacml.ctx.ResourceType)

Aggregations

CXFMessageParser (org.apache.cxf.rt.security.saml.xacml.CXFMessageParser)1 ActionType (org.opensaml.xacml.ctx.ActionType)1 AttributeType (org.opensaml.xacml.ctx.AttributeType)1 ResourceType (org.opensaml.xacml.ctx.ResourceType)1 SubjectType (org.opensaml.xacml.ctx.SubjectType)1