Class AbstractStatefulRealm

  • All Implemented Interfaces:
    Comparable<Realm>
    Direct Known Subclasses:
    Realm

    public abstract class AbstractStatefulRealm
    extends AbstractRealm
    implements Comparable<Realm>
    This class is the base for all Payara Realm classes, and contains common object state such as the realm name, general properties and the assign groups.
    Author:
    Arjan Tijms
    • Field Detail

      • PARAM_GROUPS

        public static final String PARAM_GROUPS
        Realm parameter: "assign-groups".

        Comma separated. All users authenticated by this realm will be in these groups

        See Also:
        Constant Field Values
      • PARAM_DEFAULT_DIGEST_ALGORITHM

        public static final String PARAM_DEFAULT_DIGEST_ALGORITHM
        Realm parameter: "default-digest-algorithm"
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractStatefulRealm

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

      • 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.
        Parameters:
        groups - user's groups to merge with "assign-groups" parameter. Can be null.
        Returns:
        merged array of group names. Never null.
      • 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()
        Returns:
        default digest algorithm, for example: "SHA-256"
      • getProperty

        public String getProperty​(String name)
        Get a realm property.

        Note: requires server restart when updating or removing.

        Parameters:
        name - property name.
        Returns:
        value.
      • setProperty

        public void setProperty​(String name,
                                String value)
        Set a realm property.

        Note: requires server restart when updating or removing.

        Parameters:
        name - property name.
        value - property value. Nulls are ignored.
      • getProperties

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

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

        JAAS context determines the login module(s) to be invoked by means of JAAS configuration file (login.conf in domain config directory).

        Default implementation uses value of realm's property jaas-context.

        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>