JBoss port of sunxacml 2.0.5

org.jboss.security.xacml.sunxacml.support.finder
Class URLPolicyFinderModule

java.lang.Object
  extended by org.jboss.security.xacml.sunxacml.finder.PolicyFinderModule
      extended by org.jboss.security.xacml.sunxacml.support.finder.URLPolicyFinderModule

public class URLPolicyFinderModule
extends PolicyFinderModule

This module supports references made with resolvable URLs (eg, http or file pointers). No policies are cached. Instead, all policy references are resolved in real-time. To make this module as generally applicable as possible, no errors are ever returned when attempting to resolve a policy. This means that if a resolved policy is invalid, a server cannot be contacted, etc., this module simply reports that it cannot provide a policy. If you need to report errors, or support any caching, you have to write your own implementation.

This module is provided as an example, but is still fully functional, and should be useful for many simple applications. This is provided in the support package rather than the core codebase because it implements non-standard behavior.

Since:
2.0
Author:
Seth Proctor

Constructor Summary
URLPolicyFinderModule()
          Creates a URLPolicyFinderModule.
URLPolicyFinderModule(String schemaFile)
          Creates a URLPolicyFinderModule that may do schema validation of policies.
 
Method Summary
 PolicyFinderResult findPolicy(URI idReference, int type, VersionConstraints constraints, PolicyMetaData parentMetaData)
          Attempts to find a policy by reference, based on the provided parameters.
 void init(PolicyFinder finder)
          Initialize this module.
 boolean isIdReferenceSupported()
          Always returns true since this module does support finding policies based on reference.
 
Methods inherited from class org.jboss.security.xacml.sunxacml.finder.PolicyFinderModule
findPolicy, getIdentifier, invalidateCache, isRequestSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLPolicyFinderModule

public URLPolicyFinderModule()
Creates a URLPolicyFinderModule. The schema file used to validate policies is specified by the property PolicyReader.POLICY_SCHEMA_PROPERTY. If the retrieved property is null, then no schema validation will occur.


URLPolicyFinderModule

public URLPolicyFinderModule(String schemaFile)
Creates a URLPolicyFinderModule that may do schema validation of policies.

Parameters:
schemaFile - the schema file to use for validation, or null if validation isn't desired
Method Detail

isIdReferenceSupported

public boolean isIdReferenceSupported()
Always returns true since this module does support finding policies based on reference.

Overrides:
isIdReferenceSupported in class PolicyFinderModule
Returns:
true

init

public void init(PolicyFinder finder)
Initialize this module. Typically this is called by PolicyFinder when a PDP is created.

Specified by:
init in class PolicyFinderModule
Parameters:
finder - the PolicyFinder using this module

findPolicy

public PolicyFinderResult findPolicy(URI idReference,
                                     int type,
                                     VersionConstraints constraints,
                                     PolicyMetaData parentMetaData)
Attempts to find a policy by reference, based on the provided parameters. Specifically, this module will try to treat the reference as a URL, and resolve that URL directly. If the reference is not a valid URL, cannot be resolved, or does not resolve to an XACML policy, then no matching policy is returned. This method never returns an error.

Overrides:
findPolicy in class PolicyFinderModule
Parameters:
idReference - an identifier specifying some policy
type - type of reference (policy or policySet) as identified by the fields in PolicyReference
constraints - any optional constraints on the version of the referenced policy (this will never be null, but it may impose no constraints, and in fact will never impose constraints when used from a pre-2.0 XACML policy)
parentMetaData - the meta-data from the parent policy, which provides XACML version, factories, etc.
Returns:
the result of looking for a matching policy

JBoss port of sunxacml 2.0.5

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.