Class PermissionRegistry


  • public class PermissionRegistry
    extends Object
    A collection of Permission objects, keyed by URI. Resides in the ServletContext. This is not thread-safe, so Permissions should be added only during context initialization.
    • Constructor Detail

      • PermissionRegistry

        public PermissionRegistry()
    • Method Detail

      • isRegistryCreated

        public static boolean isRegistryCreated​(javax.servlet.ServletContext ctx)
        Has the registry been created yet?
      • createRegistry

        public static void createRegistry​(javax.servlet.ServletContext ctx,
                                          Collection<? extends Permission> permissions)
        Create the registry and store it in the context.
      • getRegistry

        public static PermissionRegistry getRegistry​(javax.servlet.ServletContext ctx)
        Get the registry from the context. If there isn't one, throw an exception.
      • addPermissions

        public void addPermissions​(Collection<? extends Permission> permissions)
        This class is not thread-safe, so permissions should be added only during context initialization.
      • addPermission

        public void addPermission​(Permission p)
        This class is not thread-safe, so permissions should be added only during context initialization.
      • isPermission

        public boolean isPermission​(String uri)
        Is there a Permission registered with this URI?
      • getPermission

        public Permission getPermission​(String uri)
        Get the permission that is registered with this URI. If there is no such Permission, return a BrokenPermission that always denies authorization. If you want to know whether an actual Permission has been registered at this URI, call isPermission() instead.