本文整理汇总了Java中com.sun.xacml.finder.impl.SelectorModule类的典型用法代码示例。如果您正苦于以下问题:Java SelectorModule类的具体用法?Java SelectorModule怎么用?Java SelectorModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SelectorModule类属于com.sun.xacml.finder.impl包,在下文中一共展示了SelectorModule类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPDPConfig
import com.sun.xacml.finder.impl.SelectorModule; //导入依赖的package包/类
/**
* Create a basic PDPConfig object from a set of PolicyFinderModule
*
* @param policyModules
* @return
*/
private PDPConfig createPDPConfig(
Set<PolicyFinderModule> policyModules) {
AttributeFinder attributeFinder = new AttributeFinder();
List<AttributeFinderModule> attrModules = new ArrayList<AttributeFinderModule>();
attrModules.add(new CurrentEnvModule());
attrModules.add(new SelectorModule());
attributeFinder.setModules(attrModules);
PolicyFinder policyFinder = new PolicyFinder();
policyFinder.setModules(policyModules);
// ResourceFinder resourceFinder = new ResourceFinder();
// return new PDPConfig(attributeFinder, policyFinder, resourceFinder);
// do not use attribute finder for performance evaluation
return new PDPConfig(null, policyFinder, null);
}
示例2: SimplePDP
import com.sun.xacml.finder.impl.SelectorModule; //导入依赖的package包/类
/**
* Constructor that takes an array of filenames and URLs, each of which
* points to an XACML policy, and sets up a <code>PDP</code> with access
* to these policies only. These policies may be accessed based on
* context matching or by reference (based on their policy identifiers).
* The <code>PDP</code> is also setup to support dynamic URL references.
*
* @param policies an arry of filenames and URLs that specify policies
*
* @throws Exception
*/
public SimplePDP(String [] policies) throws Exception {
// Create the two static modules with the given policies so that
// we have context-based and reference-based access to all the
// policies provided on the command-line
List<String> policyList = Arrays.asList(policies);
StaticPolicyFinderModule staticModule =
new StaticPolicyFinderModule(PermitOverridesPolicyAlg.algId,
policyList);
StaticRefPolicyFinderModule staticRefModule =
new StaticRefPolicyFinderModule(policyList);
// also create a module that lets us get at URL-based policies
URLPolicyFinderModule urlModule = new URLPolicyFinderModule();
// next, setup the PolicyFinder that this PDP will use
PolicyFinder policyFinder = new PolicyFinder();
Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>();
policyModules.add(staticModule);
policyModules.add(staticRefModule);
policyModules.add(urlModule);
policyFinder.setModules(policyModules);
// now setup attribute finder modules for the current date/time and
// AttributeSelectors (selectors are optional, but this project does
// support a basic implementation)
CurrentEnvModule envAttributeModule = new CurrentEnvModule();
SelectorModule selectorAttributeModule = new SelectorModule();
// Setup the AttributeFinder just like we setup the PolicyFinder. Note
// that unlike with the policy finder, the order matters here. See the
// the javadocs for more details.
AttributeFinder attributeFinder = new AttributeFinder();
List<AttributeFinderModule> attributeModules = new ArrayList<AttributeFinderModule>();
attributeModules.add(envAttributeModule);
attributeModules.add(selectorAttributeModule);
attributeFinder.setModules(attributeModules);
// finally, initialize our pdp
this.pdp = new PDP(new PDPConfig(attributeFinder, policyFinder,
null, null));
}
示例3: TestPDP
import com.sun.xacml.finder.impl.SelectorModule; //导入依赖的package包/类
/**
* Constructor that takes an array of filenames, each of which contains an
* XACML policy, and sets up a <code>PDP</code> with access to these
* policies only. The <code>PDP</code> is configured programatically to
* have only a few specific modules.
*
* @param policyFiles
* an arry of filenames that specify policies
*/
public TestPDP(String policyFile) throws Exception {
// Create a PolicyFinderModule and initialize it...in this case,
// we're using the sample FilePolicyModule that is pre-configured
// with a set of policies from the filesystem
FilePolicyModule filePolicyModule = new FilePolicyModule();
filePolicyModule.addPolicy(policyFile);
// next, setup the PolicyFinder that this PDP will use
PolicyFinder policyFinder = new PolicyFinder();
Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>();
policyModules.add(filePolicyModule);
policyFinder.setModules(policyModules);
// now setup attribute finder modules for the current date/time and
// AttributeSelectors (selectors are optional, but this project does
// support a basic implementation)
CurrentEnvModule envAttributeModule = new CurrentEnvModule();
SelectorModule selectorAttributeModule = new SelectorModule();
// Setup the AttributeFinder just like we setup the PolicyFinder. Note
// that unlike with the policy finder, the order matters here. See the
// the javadocs for more details.
AttributeFinder attributeFinder = new AttributeFinder();
List<AttributeFinderModule> attributeModules = new ArrayList<AttributeFinderModule>();
attributeModules.add(envAttributeModule);
attributeModules.add(selectorAttributeModule);
attributeFinder.setModules(attributeModules);
// Try to load the time-in-range function, which is used by several
// of the examples...see the documentation for this function to
// understand why it's provided here instead of in the standard
// code base.
// FunctionFactoryProxy proxy =
// StandardFunctionFactory.getNewFactoryProxy();
// FunctionFactory factory = proxy.getConditionFactory();
// factory.addFunction(new TimeInRangeFunction());
// FunctionFactory.setDefaultFactory(proxy);
// finally, initialize our pdp
pdp = new PDP(new PDPConfig(attributeFinder, policyFinder, null));
}