org.openpermis.subject.assignment.url
Class UrlController

java.lang.Object
  extended by org.openpermis.subject.assignment.RoleAssignmentController<T>
      extended by org.openpermis.subject.assignment.CachingRoleAssignmentController<UrlContext>
          extended by org.openpermis.subject.assignment.url.UrlController
All Implemented Interfaces:
SubjectIdentityNormalizer

public class UrlController
extends CachingRoleAssignmentController<UrlContext>

Controls read-only url based role assignments .

This url controller supports only read operations.

Since:
0.9.0

Constructor Summary
UrlController(List<URL> urls, Decoder<UrlContext> decoder)
          Creates an url controller that controls role assignments from url's.
 
Method Summary
static UrlController createClasspathUrlController(Decoder<UrlContext> decoder, ClassLoader classLoader, String... resources)
          Creates a url controller for a list of resources loaded from a class loader.
static UrlController createUrlController(Decoder<UrlContext> decoder, Class<?> clazz, String... resources)
          Creates a url controller for a list of resources loaded from a class loader.
protected  UrlContext creatingNewContext(URI identity, URI issuer, Set<RoleDefinition> roles, Date validFrom, Date validTo)
          Creates a context for a role assignment.
protected  List<UrlContext> getContexts()
          Returns all contexts of this controller.
protected  byte[] readFromContext(UrlContext context)
          Reads the content of a context.
protected  void revokingAssignment(RoleAssignment<UrlContext> roleAssignment)
          Revoking the specified role assignment.
protected  void writeToContext(UrlContext context, byte[] content)
          Writes the a byte array into a context.
 
Methods inherited from class org.openpermis.subject.assignment.CachingRoleAssignmentController
createContext, issue, list, normalize, refresh, revoke
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlController

public UrlController(List<URL> urls,
                     Decoder<UrlContext> decoder)
Creates an url controller that controls role assignments from url's.

This url controller supports only read operations.

Parameters:
urls - a List of URL's.
decoder - used to decode role assignments.
Since:
0.9.0
Method Detail

createClasspathUrlController

public static UrlController createClasspathUrlController(Decoder<UrlContext> decoder,
                                                         ClassLoader classLoader,
                                                         String... resources)
Creates a url controller for a list of resources loaded from a class loader.

Uses the Thread.getContextClassLoader() as a fallback if a resource cannot be retrieved using the specified class loader.

Parameters:
decoder - used to decode role assignments. certificates, must not be null.
classLoader - the class loader to use for retrieving the resource URLs.
resources - list of resource locations to process, must not be null or empty.
See Also:
ClassLoader.getResource(String)
Returns:
the url controller created.
Since:
0.9.0

createUrlController

public static UrlController createUrlController(Decoder<UrlContext> decoder,
                                                Class<?> clazz,
                                                String... resources)
Creates a url controller for a list of resources loaded from a class loader.

Parameters:
decoder - used to decode role assignments. certificates, must not be null.
clazz - the class to use for retrieving the resource URLs.
resources - list of resource locations to process, must not be null or empty.
See Also:
Class.getResource(String)
Returns:
the url controller created.
Since:
0.9.0

writeToContext

protected void writeToContext(UrlContext context,
                              byte[] content)
                       throws RoleAssignmentControllerException
Description copied from class: CachingRoleAssignmentController
Writes the a byte array into a context.

Specified by:
writeToContext in class CachingRoleAssignmentController<UrlContext>
Parameters:
context - the context in which the byte array is written.
content - the byte array that gets written into the context.
Throws:
RoleAssignmentControllerException - signals that the assignment failed.
Since:
0.9.0

readFromContext

protected byte[] readFromContext(UrlContext context)
                          throws RoleAssignmentControllerException
Description copied from class: CachingRoleAssignmentController
Reads the content of a context.

Specified by:
readFromContext in class CachingRoleAssignmentController<UrlContext>
Parameters:
context - the context whose content is returned.
Returns:
the content of the context.
Throws:
RoleAssignmentControllerException - signals that the assignment failed.
Since:
0.9.0

getContexts

protected List<UrlContext> getContexts()
Description copied from class: CachingRoleAssignmentController
Returns all contexts of this controller.

Specified by:
getContexts in class CachingRoleAssignmentController<UrlContext>
Returns:
all contexts of this controller.
Since:
0.9.0

creatingNewContext

protected UrlContext creatingNewContext(URI identity,
                                        URI issuer,
                                        Set<RoleDefinition> roles,
                                        Date validFrom,
                                        Date validTo)
Description copied from class: CachingRoleAssignmentController
Creates a context for a role assignment.

Specified by:
creatingNewContext in class CachingRoleAssignmentController<UrlContext>
Parameters:
identity - holder of the role assignment.
issuer - the issuer of the role assignment.
roles - roles of the role assignment,
validFrom - the validity start of the role assignment.
validTo - the validity end of the role assignment.
Returns:
the context for the role assignment.
Since:
0.9.0

revokingAssignment

protected void revokingAssignment(RoleAssignment<UrlContext> roleAssignment)
Description copied from class: CachingRoleAssignmentController
Revoking the specified role assignment.

Specified by:
revokingAssignment in class CachingRoleAssignmentController<UrlContext>
Parameters:
roleAssignment - the role assignment to revoke.
Since:
0.9.0


OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:16:59
Copyright (c) 2002-2007 Ergon Informatik AG