|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.soton.itinnovation.grid.pbac2.pdp.PBACUtils
public class PBACUtils
Useful utility methods for using PBAC.
| Constructor Summary | |
|---|---|
PBACUtils(PDP pdp)
|
|
| Method Summary | |
|---|---|
void |
ensureDeployed(String type,
String policyFileName)
Try to deploy an XML policy as a PBAC policy. |
void |
ensureDeployed(String type,
String policyFileName,
ClassLoader loader)
Try to deploy an XML policy as a PBAC policy. |
boolean |
ensureServiceResource(Object serviceImpl,
PolicyRule... initialRules)
Ensure that a singleton service resource for this interface exists, creating a new one if not. |
boolean |
ensureServiceResource(String type,
String resourceID,
boolean worldRole,
PolicyRule[] initialRules)
Ensure that a singleton service resource for this interface exists, creating a new one if not. |
static String |
getDefaultVersion(String policyType)
Return the default version of this policy. |
static ArrayList<String> |
getResourceTypes()
Returns a list of known policy types. |
static String |
getStringFromResource(ClassLoader loader,
String resourceName)
|
static void |
registerDefaultPolicy(String resourceType,
String defaultPolicy)
Register the default policy for a type. |
static void |
validateOwner(MatchRule owner,
SubjectDescription currentUser,
String ownerRole)
Ensure that the 'owner' rule grants 'currentUser' the 'ownerRole' role. |
static void |
validatePattern(MatchPattern pattern,
SubjectDescription currentUser)
Ensure that the pattern matches 'currentUser'. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PBACUtils(PDP pdp)
| Method Detail |
|---|
public void ensureDeployed(String type,
String policyFileName)
type - the type of resource that will be protected with this policy.policyFileName - the resource name of an XML file (in classpath).
public void ensureDeployed(String type,
String policyFileName,
ClassLoader loader)
type - the type of resource that will be protected with this policy.policyFileName - the resource name of an XML file (in classpath).loader - ClassLoader to use to locate the resourcepublic static String getDefaultVersion(String policyType)
registerDefaultPolicy(java.lang.String, java.lang.String). Otherwise,
this reads the old pbacpolicyversions.properties file to get the version for a given type.
The built-in group type's version is hard-coded.
If no default version is set, returns a suitable error string and logs a warning
policyType - the PBAC resource type to check
public static void registerDefaultPolicy(String resourceType,
String defaultPolicy)
resourceType - the type to registerdefaultPolicy - the policy, which is an XML string with a version attribute on the rootpublic static ArrayList<String> getResourceTypes()
registerDefaultPolicy(java.lang.String, java.lang.String).
public boolean ensureServiceResource(Object serviceImpl,
PolicyRule... initialRules)
throws RemoteException
initialRules
are added also.
serviceImpl - the service object, with a PEPServiceResource annotationinitialRules - the set of initial rules to add for the service resource
RemoteException
public boolean ensureServiceResource(String type,
String resourceID,
boolean worldRole,
PolicyRule[] initialRules)
throws RemoteException
initialRules
are added also.
type - the resource type of the service policy.resourceID - the interface given as the className in the server-config.wsdd file.worldRole - when creating the resource, give everyone the 'world' role by default.initialRules - the set of initial match rules to add for the service resource
RemoteException
public static void validateOwner(MatchRule owner,
SubjectDescription currentUser,
String ownerRole)
throws RemoteException
validatePattern(uk.ac.soton.itinnovation.grid.types.MatchPattern, uk.ac.soton.itinnovation.grid.types.SubjectDescription).
RemoteException - if currentUser would not get the role
public static void validatePattern(MatchPattern pattern,
SubjectDescription currentUser)
throws RemoteException
RemoteException - if currentUser does not match, or the pattern is not valid
public static String getStringFromResource(ClassLoader loader,
String resourceName)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||