本文整理汇总了Java中org.wso2.balana.XACMLConstants.XACML_VERSION_3_0属性的典型用法代码示例。如果您正苦于以下问题:Java XACMLConstants.XACML_VERSION_3_0属性的具体用法?Java XACMLConstants.XACML_VERSION_3_0怎么用?Java XACMLConstants.XACML_VERSION_3_0使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.wso2.balana.XACMLConstants
的用法示例。
在下文中一共展示了XACMLConstants.XACML_VERSION_3_0属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMetaDataFromConditionElement
/**
* This extract policy meta data from condition element in the policy
*
* @param omElement condition element as an OMElement
* @param attributeDTOs list of AttributeDTO object which holds the policy meta data
* in String format
* @return list of AttributeDTO object which holds the policy meta data in String format
*/
public List<AttributeDTO> createMetaDataFromConditionElement(OMElement omElement,
List<AttributeDTO> attributeDTOs) {
Iterator iterator = omElement.getChildrenWithLocalName(PDPConstants.APPLY_ELEMENT);
if (iterator.hasNext()) {
if (version == XACMLConstants.XACML_VERSION_3_0) {
createMetaDataFromXACML3ApplyElement(omElement, attributeDTOs);
} else {
createMetaDataFromApplyElement(omElement, attributeDTOs);
}
} else {
AttributeDTO attributeDTO = new AttributeDTO();
attributeDTO.setCategory(PDPConstants.UNKNOWN);
attributeDTO.setAttributeValue(PDPConstants.SEARCH_WARNING_MESSAGE4);
}
// TODO currently only search meta data on Apply Element, support for other elements
return attributeDTOs;
}
示例2: getAttributes
public static Attributes getAttributes(AttributeDTO attributeDataDTO) {
try {
AttributeValue value = Balana.getInstance().getAttributeFactory().
createValue(new URI(attributeDataDTO.getAttributeDataType()),
attributeDataDTO.getAttributeValue());
Attribute attribute = new Attribute(new URI(attributeDataDTO.getAttributeId()),
null, null, value, XACMLConstants.XACML_VERSION_3_0);
Set<Attribute> set = new HashSet<Attribute>();
set.add(attribute);
String category = attributeDataDTO.getCategory();
// We are only creating XACML 3.0 requests Therefore covert order XACML categories to new uris
if (PDPConstants.SUBJECT_ELEMENT.equals(category)) {
category = PDPConstants.SUBJECT_CATEGORY_URI;
} else if (PDPConstants.RESOURCE_ELEMENT.equals(category)) {
category = PDPConstants.RESOURCE_CATEGORY_URI;
} else if (PDPConstants.ACTION_ELEMENT.equals(category)) {
category = PDPConstants.ACTION_CATEGORY_URI;
} else if (PDPConstants.ENVIRONMENT_ELEMENT.equals(category)) {
category = PDPConstants.ENVIRONMENT_CATEGORY_URI;
}
return new Attributes(new URI(category), set);
} catch (Exception e) {
log.debug(e);
//ignore and return null;
}
return null;
}
示例3: PolicyAttributeBuilder
/**
* @param policy policy as a String
*/
public PolicyAttributeBuilder(String policy) {
this.policy = policy;
String version = EntitlementUtil.getPolicyVersion(policy);
if (XACMLConstants.XACML_1_0_IDENTIFIER.equals(version)) {
this.version = XACMLConstants.XACML_VERSION_1_0;
} else if (XACMLConstants.XACML_2_0_IDENTIFIER.equals(version)) {
this.version = XACMLConstants.XACML_VERSION_2_0;
} else {
this.version = XACMLConstants.XACML_VERSION_3_0;
}
}
示例4: searchAttributeValues
/**
* This searches through attribute values in the attribute elements to extract the policy meta data
*
* @param omElement apply element as an OMElement
* @param values set of String objects
* @param searchDesignators states where, to find designators which are involved in creating
* attribute values
* @return AttributeValueDTO object which holds the policy meta data in String format
*/
public List<String> searchAttributeValues(OMElement omElement, List<String> values,
boolean searchDesignators) {
if (values != null) {
Iterator iterator = omElement.
getChildrenWithLocalName(PDPConstants.ATTRIBUTE_VALUE);
while (iterator.hasNext()) {
OMElement attributeElement = (OMElement) iterator.next();
if (attributeElement != null) {
String dataType = attributeElement.
getAttributeValue(new QName(PDPConstants.DATA_TYPE)); // TODO
values.add(attributeElement.getText());
}
}
}
Iterator iterator1 = omElement.getChildrenWithLocalName(PDPConstants.APPLY_ELEMENT);
while (iterator1.hasNext()) {
OMElement applyElement = (OMElement) iterator1.next();
searchAttributeValues(applyElement, values, searchDesignators);
AttributeDTO attributeDTO = new AttributeDTO();
if (searchDesignators) {
if (version == XACMLConstants.XACML_VERSION_3_0) {
searchXACML3Designator(applyElement, attributeDTO);
} else {
searchDesignatorOrSelector(applyElement, attributeDTO);
}
}
if (attributeDTO.getCategory() != null || attributeDTO.getAttributeId() != null ||
attributeDTO.getAttributeDataType() != null) {
values = null;
}
}
return values;
}
示例5: createMetaDataFromRuleElement
/**
* This extract policy meta data from each rule element in the policy
*
* @param omElement rule element as an OMElement
* @param attributeDTOs list of AttributeDTO object which holds the policy meta data
* in String format
* @return list of AttributeDTO object which holds the policy meta data in String format
*/
public List<AttributeDTO> createMetaDataFromRuleElement(OMElement omElement,
List<AttributeDTO> attributeDTOs) {
if (omElement != null) {
Iterator iterator1 = omElement.getChildrenWithLocalName(PDPConstants.
TARGET_ELEMENT);
while (iterator1.hasNext()) {
OMElement targetElement = (OMElement) iterator1.next();
if (version == XACMLConstants.XACML_VERSION_3_0) {
createMetaDataFromXACML3TargetElement(targetElement, attributeDTOs);
} else {
createMetaDataFromTargetElement(targetElement, attributeDTOs);
}
}
Iterator iterator2 = omElement.getChildrenWithLocalName(PDPConstants.
CONDITION_ELEMENT);
while (iterator2.hasNext()) {
OMElement conditionElement = (OMElement) iterator2.next();
createMetaDataFromConditionElement(conditionElement, attributeDTOs);
}
}
return attributeDTOs;
}
示例6: getAbstractSelector
public AbstractAttributeSelector getAbstractSelector(Node root, PolicyMetaData metaData)
throws ParsingException {
if(metaData.getXACMLVersion() == XACMLConstants.XACML_VERSION_3_0){
return org.wso2.balana.attr.xacml3.AttributeSelector.getInstance(root, metaData);
} else {
return org.wso2.balana.attr.AttributeSelector.getInstance(root, metaData);
}
}
示例7: getAbstractDesignator
public AbstractDesignator getAbstractDesignator(Node root, PolicyMetaData metaData)
throws ParsingException {
if(metaData.getXACMLVersion() == XACMLConstants.XACML_VERSION_3_0){
return AttributeDesignator.getInstance(root);
} else {
return org.wso2.balana.attr.AttributeDesignator.getInstance(root);
}
}
示例8: RequestCtx
/**
* Constructor that creates a <code>RequestCtx</code> from components.
*
* @param documentRoot the root node of the DOM tree for this request
* @param attributesSet a <code>Set</code> of <code>Attributes</code>s
* @param returnPolicyIdList a <code>boolean</code> value whether to send back policy list of not
* @param combinedDecision a <code>boolean</code> value whether to combine decisions or not
* @param multiRequests a <code>MultiRequests</code> for the MultiRequests element in request
* @param defaults a <code>RequestDefaults</code> for the RequestDefaults element in request
* @throws IllegalArgumentException if the inputs are not well formed
*/
public RequestCtx(Node documentRoot, Set<Attributes> attributesSet, boolean returnPolicyIdList,
boolean combinedDecision, MultiRequests multiRequests,
RequestDefaults defaults) throws IllegalArgumentException {
this.xacmlVersion = XACMLConstants.XACML_VERSION_3_0;
this.documentRoot = documentRoot;
this.attributesSet = attributesSet;
this.returnPolicyIdList = returnPolicyIdList;
this.combinedDecision = combinedDecision;
this.multiRequests = multiRequests;
this.defaults = defaults;
}
示例9: getEvaluationCtx
public EvaluationCtx getEvaluationCtx(AbstractRequestCtx requestCtx, PDPConfig pdpConfig)
throws ParsingException {
if(XACMLConstants.XACML_VERSION_3_0 == requestCtx.getXacmlVersion()){
return new XACML3EvaluationCtx((RequestCtx)requestCtx, pdpConfig);
} else {
return new XACML2EvaluationCtx((org.wso2.balana.ctx.xacml2.RequestCtx) requestCtx, pdpConfig);
}
}
示例10: getResult
/**
* Returns instance of <code>AbstractResult</code> based one the XACML version.
* Constructs a <code>AbstractResult</code> object with decision and evaluation ctx
*
* @param decision decision the decision effect to include in this result.
* @param obligationResults a list of <code>ObligationResult</code> objects
* @param advices a list of <code>Advice</code> objects
* @param evaluationCtx context of a single policy evaluation
* @return <code>AbstractResult</code> object
*/
public AbstractResult getResult(int decision, List<ObligationResult> obligationResults,
List<Advice> advices, EvaluationCtx evaluationCtx) {
if(evaluationCtx.getXacmlVersion() == XACMLConstants.XACML_VERSION_3_0){
return new Result(decision, null, obligationResults,
advices, evaluationCtx);
} else {
return new org.wso2.balana.ctx.xacml2.Result(decision, null, obligationResults);
}
}
示例11: getResult
/**
* Returns instance of <code>AbstractResult</code> based one the XACML version.
* Constructs a <code>AbstractResult</code> object with decision and evaluation ctx
*
* @param decision decision the decision effect to include in this result.
* @param evaluationCtx context of a single policy evaluation
* @return <code>AbstractResult</code> object
*/
public AbstractResult getResult(int decision, EvaluationCtx evaluationCtx) {
if(evaluationCtx.getXacmlVersion() == XACMLConstants.XACML_VERSION_3_0){
return new Result(decision, null, null, null,evaluationCtx);
} else {
return new org.wso2.balana.ctx.xacml2.Result(decision, null);
}
}
示例12: testParse
@Test
public void testParse() {
AttributeValue attributeValue = new StringAttribute("http://127.0.0.1");
List<AttributeValue> attributeValues = new ArrayList<>();
attributeValues.add(attributeValue);
Attribute attribute = new Attribute(URI.create("urn:oasis:names:tc:xacml:1.0:resource:resource-id"),
null, null, null, attributeValues, false, XACMLConstants.XACML_VERSION_3_0);
Set<Attribute> attributeSet = new HashSet<>();
attributeSet.add(attribute);
Attributes category = new Attributes(URI.create(EntitlementEndpointConstants.CATEGORY_RESOURCE_URI),
attributeSet);
Set<Attributes> categories = new HashSet<>();
categories.add(category);
RequestCtx requestCtx = new RequestCtx(categories, null);
String jsonRequest = "{\n" +
" \"Request\":{\n" +
" \"Action\":{\n" +
" \"Attribute\":[{\n" +
" \"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:action:action-id\",\n" +
" \"Value\":\"read\"\n" +
" }]\n" +
" },\n" +
" \"Resource\":{\n" +
" \"Attribute\":[{\n" +
" \"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\",\n" +
" \"Value\":\"http://127.0.0.1/service/very_secure/\"\n" +
" }]\n" +
" }\n" +
" }\n" +
"}";
String jsonRequest2 = "{\"Request\":\n" +
"{\n" +
"\"AccessSubject\":{\n" +
" \"Content\": \"PD94bWwgdmVyc2lvbj0iMS4wIj8+DQo8Y2F0YWxvZz48Ym9vayBpZD0iYmsxMDEiPjxhdXRob3I+R2FtYmFyZGVsbGEsIE1hdHRoZXc8L2F1dGhvcj48dGl0bGU+WE1MIERldmVsb3BlcidzIEd1aWRlPC90aXRsZT48Z2VucmU+Q29tcHV0ZXI8L2dlbnJlPjxwcmljZT40NC45NTwvcHJpY2U+PHB1Ymxpc2hfZGF0ZT4yMDAwLTEwLTAxPC9wdWJsaXNoX2RhdGU+PGRlc2NyaXB0aW9uPkFuIGluLWRlcHRoIGxvb2sgYXQgY3JlYXRpbmcgYXBwbGljYXRpb25zIHdpdGggWE1MLjwvZGVzY3JpcHRpb24+PC9ib29rPjwvY2F0YWxvZz4=\"\n" +
"}\n" +
"}}";
try {
RequestCtx requestCtx1 = JSONRequestParser.parse(jsonRequest);
} catch (Exception e) {
log.error("Exception in JSON Parser Test");
}
}