Class JndiRealmFactory

  • All Implemented Interfaces:
    RealmFactory

    public class JndiRealmFactory
    extends JndiLocator
    implements RealmFactory
    Looks up one or more Realm instances from JNDI using specified jndiNames.

    This is primarily provided to support Realm instances configured in JEE and EJB environments, but will work in any environment where Realm instances are bound in JNDI instead of using programmatic or text-based configuration.

    Since:
    0.9
    • Constructor Detail

      • JndiRealmFactory

        public JndiRealmFactory()
    • Method Detail

      • setJndiNames

        public void setJndiNames(Collection<String> jndiNames)
        Sets the JNDI names that will be used to look up Realm(s) from JNDI.

        The order of the collection determines the order that the Realms will be returned to the SecurityManager.

        If you find it easier to specify these names as a comma-delmited string, you may use the setJndiNames(String) method instead.
        Parameters:
        jndiNames - the JNDI names that will be used to look up Realm(s) from JNDI.
        See Also:
        setJndiNames(String)
      • setJndiNames

        public void setJndiNames(String commaDelimited)
                          throws IllegalStateException
        Specifies a comma-delimited list of JNDI names to lookup, each one corresponding to a jndi-bound Realm. The Realms will be made available to the SecurityManager in the order they are defined.
        Parameters:
        commaDelimited - a comma-delimited list of JNDI names, each representing the JNDI name used to look up a corresponding jndi-bound Realm.
        Throws:
        IllegalStateException - if the specified argument is null or the empty string.