Class JndiRealmFactory
java.lang.Object
org.apache.shiro.jndi.JndiLocator
org.apache.shiro.realm.jndi.JndiRealmFactory
- All Implemented Interfaces:
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
-
Field Summary
Fields inherited from class org.apache.shiro.jndi.JndiLocator
CONTAINER_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the JNDI names that will be used to look up Realm(s) from JNDI.Performs the JNDI lookups for each specifiedJNDI nameand returns all discovered Realms in an ordered collection.voidsetJndiNames(String commaDelimited) Specifies a comma-delimited list of JNDI names to lookup, each one corresponding to a jndi-boundRealm.voidsetJndiNames(Collection<String> jndiNames) Sets the JNDI names that will be used to look up Realm(s) from JNDI.Methods inherited from class org.apache.shiro.jndi.JndiLocator
convertJndiName, getJndiEnvironment, getJndiTemplate, isResourceRef, lookup, lookup, setJndiEnvironment, setJndiTemplate, setResourceRef
-
Constructor Details
-
JndiRealmFactory
public JndiRealmFactory()
-
-
Method Details
-
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
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-delimited string, you may use thesetJndiNames(String)method instead.- Parameters:
jndiNames- the JNDI names that will be used to look up Realm(s) from JNDI.- See Also:
-
setJndiNames
Specifies a comma-delimited list of JNDI names to lookup, each one corresponding to a jndi-boundRealm. 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.
-
getRealms
Performs the JNDI lookups for each specifiedJNDI nameand returns all discovered Realms in an ordered collection.The returned Collection is in the same order as the specified
jndiNames- Specified by:
getRealmsin interfaceRealmFactory- Returns:
- an ordered collection of the
specified Realmsfound in JNDI. - Throws:
IllegalStateException- if any of the JNDI names fails to successfully look up a Realm instance.
-