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

      • getJndiNames

        public <> getJndiNames()
        Returns the JNDI names that will be used to look up Realm(s) from JNDI.
        Returns:
        the JNDI names that will be used to look up Realm(s) from JNDI.
        See Also:
        setJndiNames(String), setJndiNames(Collection)
      • setJndiNames

        public void setJndiNames​(<> 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​( commaDelimited)
                          throws 
        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:
        - if the specified argument is null or the empty string.
      • getRealms

        public <Realm> getRealms()
                                    throws 
        Performs the JNDI lookups for each specified JNDI name and returns all discovered Realms in an ordered collection.

        The returned Collection is in the same order as the specified jndiNames

        Specified by:
        getRealms in interface RealmFactory
        Returns:
        an ordered collection of the specified Realms found in JNDI.
        Throws:
        - if any of the JNDI names fails to successfully look up a Realm instance.