Class AbstractGlassFishRealmState

java.lang.Object
com.sun.enterprise.security.auth.realm.AbstractGlassFishRealmState
All Implemented Interfaces:
Comparable<Realm>
Direct Known Subclasses:
Realm

public abstract class AbstractGlassFishRealmState extends Object implements Comparable<Realm>
Abstract class that stores the common state for all Realms.

This basically includes the realm name, a number of properties, and specifically a number of (extra) groups which are always assigned to an authenticated caller.

  • Field Details

  • Constructor Details

    • AbstractGlassFishRealmState

      protected AbstractGlassFishRealmState()
      The default the constructor creates a realm which will later be initialized, either from properties or by deserializing.
  • Method Details

    • init

      protected void init(Properties properties) throws BadRealmException, NoSuchRealmException
      Initialize a realm with some properties. This can be used when instantiating realms from their descriptions. This method may only be called a single time.
      Parameters:
      properties - initialization parameters used by this realm.
      Throws:
      BadRealmException - if the configuration parameters identify a corrupt realm
      NoSuchRealmException - if the configuration parameters specify a realm which doesn't exist
    • addAssignGroups

      protected String[] addAssignGroups(String[] groups)
      Add assign groups to given array of groups. To be used by getGroupNames.
      Parameters:
      groups -
      Returns:
    • getMappedGroupNames

      protected ArrayList<String> getMappedGroupNames(String group)
    • refresh

      public void refresh(String configName) throws BadRealmException
      Refreshes the realm data so that new users/groups are visible.
      Parameters:
      configName -
      Throws:
      BadRealmException - if realm data structures are bad
    • getName

      public final String getName()
      Returns the name of this realm.
      Returns:
      realm name.
    • setName

      protected final void setName(String name)
      Assigns the name of this realm, and stores it in the cache of realms. Used when initializing a newly created in-memory realm object; if the realm already has a name, there is no effect.
      Parameters:
      name - name to be assigned to this realm.
    • getDefaultDigestAlgorithm

      protected String getDefaultDigestAlgorithm()
    • getProperty

      public String getProperty(String name)
      Get a realm property.
      Parameters:
      name - property name.
      Returns:
    • setProperty

      public void setProperty(String name, String value)
      Set a realm property.
      Parameters:
      name - property name.
      value - property value.
    • getProperties

      protected Properties getProperties()
      Return properties of the realm.
      Returns:
    • getAuthType

      public abstract String getAuthType()
      Returns a short (preferably less than fifteen characters) description of the kind of authentication which is supported by this realm.
      Returns:
      description of the kind of authentication that is directly supported by this realm.
    • getJAASContext

      public String getJAASContext()
      Returns name of JAAS context used by this realm.

      The JAAS context is defined in server.xml auth-realm element associated with this realm.

      Returns:
      String containing JAAS context name.
    • toString

      public String toString()
      Returns the name of this realm.
      Overrides:
      toString in class Object
      Returns:
      name of realm.
    • compareTo

      public int compareTo(Realm otherRealm)
      Compares a realm to another.

      The comparison first considers the authentication type, so that realms supporting the same kind of user authentication are grouped together. Then it compares realm realm names. Realms compare "before" other kinds of objects (i.e. there's only a partial order defined, in the case that those other objects compare themselves "before" a realm object).

      Specified by:
      compareTo in interface Comparable<Realm>