|
||||||||||
| 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()
|
|
| Method Summary | |
|---|---|
static Document |
createValidationResponse(String code,
String reason)
Create a RequestSecurityTokenResponse for a status validation. |
static void |
ensureDeployed(String type,
String policyFileName)
Try to deploy an XML policy as a PBAC policy. |
static void |
ensureDeployed(String type,
String policyFileName,
ClassLoader loader)
Try to deploy an XML policy as a PBAC policy. |
static boolean |
ensureServiceResource(Object serviceImpl,
MatchRule[] initialRules)
Ensure that a singleton service resource for this interface exists, creating a new one if not. |
static boolean |
ensureServiceResource(String type,
Class iface,
boolean worldRole)
Deprecated. Use ensureServiceResource(Object, MatchRule[]). |
static void |
ensureServiceResource(String type,
Class iface,
boolean worldRole,
MatchRule[] initialRules)
Deprecated. Use ensureServiceResource(Object, MatchRule[]). |
static void |
ensureValidationSuccessful(Document response)
Process a WS-Trust validation response. |
static String |
getDefaultVersion(String policyType)
Return the default version of this policy. |
static ArrayList<String> |
getResourceTypes()
Returns a list of known policy types. |
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()
| Method Detail |
|---|
public static 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 static 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 static boolean ensureServiceResource(String type,
Class iface,
boolean worldRole)
throws GridFailureException
ensureServiceResource(Object, MatchRule[]).
type - the resource type of the service policy.iface - the interface given as the className in the server-config.wsdd file.worldRole - when creating the resource, give everyone the 'world' role by default.
true if the service resource was created,
false if it already existed.
GridFailureException
public static void ensureServiceResource(String type,
Class iface,
boolean worldRole,
MatchRule[] initialRules)
throws GridFailureException
ensureServiceResource(Object, MatchRule[]).
initialRules
are added also.
type - the resource type of the service policy.iface - 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
GridFailureException
public static boolean ensureServiceResource(Object serviceImpl,
MatchRule[] initialRules)
throws GridFailureException
initialRules
are added also.
serviceImpl - the service object, with a PEPServiceResource annotationinitialRules - the set of initial match rules to add for the service resource
GridFailureException
public static void validateOwner(MatchRule owner,
SubjectDescription currentUser,
String ownerRole)
throws GridFailureException
validatePattern(uk.ac.soton.itinnovation.grid.types.MatchPattern, uk.ac.soton.itinnovation.grid.types.SubjectDescription).
GridFailureException - if currentUser would not get the role
public static void validatePattern(MatchPattern pattern,
SubjectDescription currentUser)
throws GridFailureException
GridFailureException - if currentUser does not match, or the pattern is not valid
public static Document createValidationResponse(String code,
String reason)
code - should be WSTrust.WSTRUST_STATUS_VALID or WSTrust.WSTRUST_STATUS_INVALIDreason - a human-readable reason, or null
public static void ensureValidationSuccessful(Document response)
throws TokenInvalidException
response - from a validation operation
TokenInvalidException - if the response code is not WSTrust.WSTRUST_STATUS_VALID
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||