Interface Hive

  • All Known Implementing Classes:
    BasicHive, SimpleCachingHive

    public interface Hive
    A Hive contains the security policy for the system, much like the Policy in JAAS does. However where the Policy only has a single instance for each virtual machine, multiple Hives are allowed per vm. Allowing for instance multiple web applications to each have there own security policies or share one. In effect making a hive a codebased policy. The HiveMind keeps a registry of hives based on keys, everyone with the right key can access that hive, this allows you to choose if multiple (different) webapps all share the same same hive or let each instance of an application have there own hive. The key (sometimes referred to as the "queen", to stick with wasp terminology ;)) can be any object. A good choice would be the application itself or if it is a web application the contextname could be used.
    Author:
    marrink
    • Method Detail

      • containsPrincipal

        boolean containsPrincipal​(Principal principal)
        Checks if this hive contains an exact match for this principal.
        Parameters:
        principal -
        Returns:
        true if the hive contains the principal, false otherwise.
      • containsPermission

        boolean containsPermission​(Permission permission)
        Checks if this hive contains exactly the permission.
        Parameters:
        permission -
        Returns:
        true if the hive contains the permission.
      • hasPermission

        boolean hasPermission​(Subject subject,
                              Permission permission)
        Checks if the subject has the exact permission, or if the permission is implied by any of the subjects principals.
        Parameters:
        subject - the (optional) subject
        permission - the permission to check.
        Returns:
        true if the subject has or implies the permission, false otherwise.
      • getPrincipals

        Set<Principal> getPrincipals​(Permission permission)
        Returns a set of Principals, each containing this permission. Implementors must not allow modifications to the set change the internal state of the hive.
        Parameters:
        permission -
        Returns:
        set, never null
      • getPermissions

        Set<Permission> getPermissions​(Principal principal)
        Returns a set of Permissions, contained within the principal. Implementors must not allow modifications to the set change the internal state of the hive.
        Parameters:
        principal -
        Returns:
        set, never null