当前位置: 首页>>代码示例>>Java>>正文


Java RequestType.setEnvironment方法代码示例

本文整理汇总了Java中org.herasaf.xacml.core.context.impl.RequestType.setEnvironment方法的典型用法代码示例。如果您正苦于以下问题:Java RequestType.setEnvironment方法的具体用法?Java RequestType.setEnvironment怎么用?Java RequestType.setEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.herasaf.xacml.core.context.impl.RequestType的用法示例。


在下文中一共展示了RequestType.setEnvironment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createXacmlRequestWithNoResource

import org.herasaf.xacml.core.context.impl.RequestType; //导入方法依赖的package包/类
private RequestType createXacmlRequestWithNoResource(String subjectId) {
	ObjectFactory ofHerasContext = new ObjectFactory();
	
	//create the request query
	RequestType request = ofHerasContext.createRequestType();

	//create the Subject
	SubjectType subjectEmail = ofHerasContext.createSubjectType();

	org.herasaf.xacml.core.context.impl.AttributeType attributeEmail = ofHerasContext.createAttributeType();
	AttributeValueType attributeValue = ofHerasContext.createAttributeValueType();
	StringDataTypeAttribute stringDataType = new StringDataTypeAttribute();

	attributeEmail.setAttributeId("http://www.primelife.eu/ppl/email");
	attributeEmail.setDataType(stringDataType);
	
	attributeValue.getContent().add(subjectId);
	attributeEmail.getAttributeValues().add(attributeValue);
	subjectEmail.getAttributes().add(attributeEmail);
	request.getSubjects().add(subjectEmail);

	// create "read" action
	AttributeValueType attributeValueAction = ofHerasContext.createAttributeValueType();
	attributeValueAction.getContent().add("read");
	org.herasaf.xacml.core.context.impl.AttributeType attributeAction = ofHerasContext.createAttributeType();
	attributeAction.setAttributeId("urn:oasis:names:tc:xacml:1.0:action:action-id");
	attributeAction.setDataType(new StringDataTypeAttribute());
	attributeAction.getAttributeValues().add(attributeValueAction);
	ActionType action = ofHerasContext.createActionType();
	action.getAttributes().add(attributeAction);
	request.setAction(action);

	// create empty environment
	request.setEnvironment(new EnvironmentType());

	return request;
}
 
开发者ID:fdicerbo,项目名称:fiware-ppl,代码行数:38,代码来源:PdpTest.java

示例2: createXacmlMalFormedRequest

import org.herasaf.xacml.core.context.impl.RequestType; //导入方法依赖的package包/类
private RequestType createXacmlMalFormedRequest(String resourceId) {
	ObjectFactory ofHerasContext = new ObjectFactory();
	
	//create the request query
	RequestType request = ofHerasContext.createRequestType();

	//create the Subject
	
	// create Resource with the value of attributeType
	ResourceType resource = ofHerasContext.createResourceType();
	org.herasaf.xacml.core.context.impl.AttributeType resourceAttr = ofHerasContext.createAttributeType();
	AttributeValueType resourceAttrValue = ofHerasContext.createAttributeValueType();

	resourceAttr.setAttributeId("http://www.primelife.eu/ppl/fileName");
	resourceAttr.setDataType(new StringDataTypeAttribute());

	resourceAttrValue.getContent().add(resourceId);
	resourceAttr.getAttributeValues().add(resourceAttrValue);
	resource.getAttributes().add(resourceAttr);
	request.getResources().add(resource);

	// create "read" action
	AttributeValueType attributeValueAction = ofHerasContext.createAttributeValueType();
	attributeValueAction.getContent().add("read");
	org.herasaf.xacml.core.context.impl.AttributeType attributeAction = ofHerasContext.createAttributeType();
	attributeAction.setAttributeId("urn:oasis:names:tc:xacml:1.0:action:action-id");
	attributeAction.setDataType(new StringDataTypeAttribute());
	attributeAction.getAttributeValues().add(attributeValueAction);
	ActionType action = ofHerasContext.createActionType();
	action.getAttributes().add(attributeAction);
	request.setAction(action);

	// create empty environment
	request.setEnvironment(new EnvironmentType());

	return request;
}
 
开发者ID:fdicerbo,项目名称:fiware-ppl,代码行数:38,代码来源:PdpTest.java

示例3: createDummyXacmlRequest

import org.herasaf.xacml.core.context.impl.RequestType; //导入方法依赖的package包/类
/**
 * Create a simple XACML Request with a data controller id, used for testing.
 * @param dataControllerId
 * @param attributeName
 * @return a request to be used for HERAS access control
 */
public static RequestType createDummyXacmlRequest(String dataControllerId, String attributeName) {
	//create the request query
	RequestType request = ofHerasContext.createRequestType();

	//create the DC Id subject
	SubjectType subjectDcId = ofHerasContext.createSubjectType();

	if (dataControllerId != null) {
		org.herasaf.xacml.core.context.impl.AttributeType attributeDcId = ofHerasContext.createAttributeType();
		AttributeValueType attributeValue = ofHerasContext.createAttributeValueType();
		AnyURIDataTypeAttribute anyURI = new AnyURIDataTypeAttribute();

		attributeDcId.setAttributeId("http://www.primelife.eu/ppl/DataControllerID");
		attributeDcId.setDataType(anyURI);
		attributeDcId.setIssuer(dataControllerId);

		attributeValue.getContent().add(dataControllerId);
		attributeDcId.getAttributeValues().add(attributeValue);
		subjectDcId.getAttributes().add(attributeDcId);

		request.getSubjects().add(subjectDcId);
	}

	//no european privacy Seal

	// create resource with the value of attributeType
	ResourceType resource = ofHerasContext.createResourceType();
	org.herasaf.xacml.core.context.impl.AttributeType resourceAttr = ofHerasContext.createAttributeType();
	AttributeValueType resourceAttrValue = ofHerasContext.createAttributeValueType();

	resourceAttr.setAttributeId("http://www.primelife.eu/ppl/UncertifiedAttributeType");
	resourceAttr.setDataType(new AnyURIDataTypeAttribute());
	resourceAttr.setIssuer(dataControllerId);

	resourceAttrValue.getContent().add(attributeName);
	resourceAttr.getAttributeValues().add(resourceAttrValue);
	resource.getAttributes().add(resourceAttr);
	request.getResources().add(resource);

	// create "read" action
	AttributeValueType attributeValueAction = ofHerasContext.createAttributeValueType();
	attributeValueAction.getContent().add("read");
	org.herasaf.xacml.core.context.impl.AttributeType attributeAction = ofHerasContext.createAttributeType();
	attributeAction.setAttributeId("urn:oasis:names:tc:xacml:1.0:action:action-id");
	attributeAction.setDataType(new StringDataTypeAttribute());
	attributeAction.setIssuer(dataControllerId);
	attributeAction.getAttributeValues().add(attributeValueAction);
	ActionType action = ofHerasContext.createActionType();
	action.getAttributes().add(attributeAction);
	request.setAction(action);

	// create empty environment
	request.setEnvironment(new EnvironmentType());

	return request;
}
 
开发者ID:fdicerbo,项目名称:fiware-ppl,代码行数:63,代码来源:PDPRequest.java

示例4: createXacmlRequest

import org.herasaf.xacml.core.context.impl.RequestType; //导入方法依赖的package包/类
/**
 * Create a simple XACML Request
 * With one resource and one subject
 * Action: read
 * @param email
 * @param resourceValue
 * @return a request to be used for HERAS access control
 */
public static RequestType createXacmlRequest(String subjectId, String resourceId) {
	//create the request query
	RequestType request = ofHerasContext.createRequestType();

	//create the Subject
	SubjectType subjectEmail = ofHerasContext.createSubjectType();

	org.herasaf.xacml.core.context.impl.AttributeType attributeEmail = ofHerasContext.createAttributeType();
	AttributeValueType attributeValue = ofHerasContext.createAttributeValueType();
	StringDataTypeAttribute stringDataType = new StringDataTypeAttribute();

	attributeEmail.setAttributeId("http://www.primelife.eu/ppl/email");
	attributeEmail.setDataType(stringDataType);
	
	attributeValue.getContent().add(subjectId);
	attributeEmail.getAttributeValues().add(attributeValue);
	subjectEmail.getAttributes().add(attributeEmail);
	request.getSubjects().add(subjectEmail);
	
	// create Resource with the value of attributeType
	ResourceType resource = ofHerasContext.createResourceType();
	org.herasaf.xacml.core.context.impl.AttributeType resourceAttr = ofHerasContext.createAttributeType();
	AttributeValueType resourceAttrValue = ofHerasContext.createAttributeValueType();

	resourceAttr.setAttributeId("http://www.primelife.eu/ppl/fileName");
	resourceAttr.setDataType(new StringDataTypeAttribute());

	resourceAttrValue.getContent().add(resourceId);
	resourceAttr.getAttributeValues().add(resourceAttrValue);
	resource.getAttributes().add(resourceAttr);
	request.getResources().add(resource);

	// create "read" action
	AttributeValueType attributeValueAction = ofHerasContext.createAttributeValueType();
	attributeValueAction.getContent().add("read");
	org.herasaf.xacml.core.context.impl.AttributeType attributeAction = ofHerasContext.createAttributeType();
	attributeAction.setAttributeId("urn:oasis:names:tc:xacml:1.0:action:action-id");
	attributeAction.setDataType(new StringDataTypeAttribute());
	attributeAction.getAttributeValues().add(attributeValueAction);
	ActionType action = ofHerasContext.createActionType();
	action.getAttributes().add(attributeAction);
	request.setAction(action);

	// create empty environment
	request.setEnvironment(new EnvironmentType());

	return request;
}
 
开发者ID:fdicerbo,项目名称:fiware-ppl,代码行数:57,代码来源:PDPRequest.java

示例5: createRequestContext

import org.herasaf.xacml.core.context.impl.RequestType; //导入方法依赖的package包/类
/**
 * Prepares the request for the matching.
 */
private RequestCtx createRequestContext(String domain, String resourceType) {
	ofHerasContext = new org.herasaf.xacml.core.context.impl.ObjectFactory();
	RequestType request = ofHerasContext.createRequestType();

	// set Subject element
	SubjectType subject = ofHerasContext.createSubjectType();
	AttributeType attribute = ofHerasContext.createAttributeType();
	AttributeValueType attributeValue = ofHerasContext.createAttributeValueType();

	attribute.setAttributeId("http://www.primelife.eu/ppl/DataControllerID");
	attribute.setDataType(new AnyURIDataTypeAttribute());
	attribute.setIssuer(domain);

	attributeValue.getContent().add(domain);
	attribute.getAttributeValues().add(attributeValue);
	subject.getAttributes().add(attribute);
	request.getSubjects().add(subject);

	// set Resource element
	ResourceType resource = ofHerasContext.createResourceType();
	AttributeType resourceAttr = ofHerasContext.createAttributeType();
	AttributeValueType resourceAttrValue = ofHerasContext.createAttributeValueType();

	resourceAttr.setAttributeId("http://www.primelife.eu/ppl/UncertifiedAttributeType");
	resourceAttr.setDataType(new AnyURIDataTypeAttribute());
	resourceAttr.setIssuer(domain);

	resourceAttrValue.getContent().add(resourceType);
	resourceAttr.getAttributeValues().add(resourceAttrValue);
	resource.getAttributes().add(resourceAttr);
	request.getResources().add(resource);

	// set Action element
	ActionType action = ofHerasContext.createActionType();
	AttributeType actionAttr = ofHerasContext.createAttributeType();
	AttributeValueType actionAttrValue = ofHerasContext.createAttributeValueType();

	actionAttr.setAttributeId("urn:oasis:names:tc:xacml:1.0:action:action-id");
	actionAttr.setDataType(new StringDataTypeAttribute());

	actionAttrValue.getContent().add("read");
	actionAttr.getAttributeValues().add(actionAttrValue);
	action.getAttributes().add(actionAttr);
	request.setAction(action);

	// set Environment
	request.setEnvironment(ofHerasContext.createEnvironmentType());
	return new RequestCtx(request);
}
 
开发者ID:fdicerbo,项目名称:fiware-ppl,代码行数:53,代码来源:HerasPdpTest.java

示例6: createXacmlRequest

import org.herasaf.xacml.core.context.impl.RequestType; //导入方法依赖的package包/类
private RequestType createXacmlRequest(String subjectId, String resourceId) {
	ObjectFactory ofHerasContext = new ObjectFactory();
	
	//create the request query
	RequestType request = ofHerasContext.createRequestType();

	//create the Subject
	SubjectType subjectEmail = ofHerasContext.createSubjectType();

	org.herasaf.xacml.core.context.impl.AttributeType attributeEmail = ofHerasContext.createAttributeType();
	AttributeValueType attributeValue = ofHerasContext.createAttributeValueType();
	StringDataTypeAttribute stringDataType = new StringDataTypeAttribute();

	attributeEmail.setAttributeId("http://www.primelife.eu/ppl/email");
	attributeEmail.setDataType(stringDataType);
	
	attributeValue.getContent().add(subjectId);
	attributeEmail.getAttributeValues().add(attributeValue);
	subjectEmail.getAttributes().add(attributeEmail);
	request.getSubjects().add(subjectEmail);
	
	// create Resource with the value of attributeType
	ResourceType resource = ofHerasContext.createResourceType();
	org.herasaf.xacml.core.context.impl.AttributeType resourceAttr = ofHerasContext.createAttributeType();
	AttributeValueType resourceAttrValue = ofHerasContext.createAttributeValueType();

	resourceAttr.setAttributeId("http://www.primelife.eu/ppl/fileName");
	resourceAttr.setDataType(new StringDataTypeAttribute());

	resourceAttrValue.getContent().add(resourceId);
	resourceAttr.getAttributeValues().add(resourceAttrValue);
	resource.getAttributes().add(resourceAttr);
	request.getResources().add(resource);

	// create "read" action
	AttributeValueType attributeValueAction = ofHerasContext.createAttributeValueType();
	attributeValueAction.getContent().add("read");
	org.herasaf.xacml.core.context.impl.AttributeType attributeAction = ofHerasContext.createAttributeType();
	attributeAction.setAttributeId("urn:oasis:names:tc:xacml:1.0:action:action-id");
	attributeAction.setDataType(new StringDataTypeAttribute());
	attributeAction.getAttributeValues().add(attributeValueAction);
	ActionType action = ofHerasContext.createActionType();
	action.getAttributes().add(attributeAction);
	request.setAction(action);

	// create empty environment
	request.setEnvironment(new EnvironmentType());

	return request;
}
 
开发者ID:fdicerbo,项目名称:fiware-ppl,代码行数:51,代码来源:PdpTest.java


注:本文中的org.herasaf.xacml.core.context.impl.RequestType.setEnvironment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。