Package org.jivesoftware.openfire.auth
Class PropertyBasedAuthProviderMapper
- java.lang.Object
-
- org.jivesoftware.openfire.auth.PropertyBasedAuthProviderMapper
-
- All Implemented Interfaces:
AuthProviderMapper
public class PropertyBasedAuthProviderMapper extends Object implements AuthProviderMapper
AAuthProviderMapper
that can be used to draw some users from another source than the other users. This implementation uses properties to define sets of usernames and a corresponding provider. When a user is not in any set, a fallback provider is used. Each set of usernames is defined by two properties. Use the following property to define the classname of anAuthProvider
to be used for this set:propertyBasedAuthMapper.set.SET_NAME.provider.className
Use the following property to identify a set of usernames:propertyBasedAuthMapper.set.SET_NAME.members
. The value for this property must be the name of another property, which is a listing of usernames (such a property is likely re-used in a correspondingPropertyBasedUserProviderMapper
configuration). There is no upper bound on the amount of sets that can be configured. Users that are not in any set will use the fallback provider. This provider is defined by its class name in the propertypropertyBasedAuthMapper.fallbackProvider.className
. The following example defines two sets. Set "A" serves users john, jane and jack, and uses a DefaultAuthProvider. Set "B" serves users dave and doris, and uses A JDBCAuthProvider. All other users are served by the fallback provider that is a NativeAuthProvider.members.set.A = List( "john", "jane", "jack" )
members.set.B = List( "dave", "doris" )
propertyBasedAuthMapper.set.A.provider.className = org.jivesoftware.openfire.auth.DefaultAuthProvider
propertyBasedAuthMapper.set.A.members.propertyName = members.set.A
propertyBasedAuthMapper.set.B.provider.className = org.jivesoftware.openfire.auth.JDBCAuthProvider
propertyBasedAuthMapper.set.B.members.propertyName = members.set.B
propertyBasedAuthMapper.fallbackProvider.className = org.jivesoftware.openfire.auth.NativeAuthProvider
- Author:
- Guus der Kinderen, guus@goodbytes.nl
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthProvider
fallbackProvider
protected Map<String,AuthProvider>
providersByPrefix
-
Constructor Summary
Constructors Constructor Description PropertyBasedAuthProviderMapper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthProvider
getAuthProvider(String username)
Finds a suitable AuthProvider for the user.Set<AuthProvider>
getAuthProviders()
Returns all providers that are used by this instance.protected static AuthProvider
instantiateProvider(String propertyName)
-
-
-
Field Detail
-
providersByPrefix
protected final Map<String,AuthProvider> providersByPrefix
-
fallbackProvider
protected AuthProvider fallbackProvider
-
-
Method Detail
-
getAuthProvider
public AuthProvider getAuthProvider(String username)
Description copied from interface:AuthProviderMapper
Finds a suitable AuthProvider for the user. Returns null when no AuthProvider can be found for the particular user.- Specified by:
getAuthProvider
in interfaceAuthProviderMapper
- Parameters:
username
- A user identifier (cannot be null or empty).- Returns:
- An AuthProvider for the user (possibly null).
-
getAuthProviders
public Set<AuthProvider> getAuthProviders()
Description copied from interface:AuthProviderMapper
Returns all providers that are used by this instance. The returned collection should have a consistent, predictable iteration order.- Specified by:
getAuthProviders
in interfaceAuthProviderMapper
- Returns:
- all providers (never null).
-
instantiateProvider
protected static AuthProvider instantiateProvider(String propertyName)
-
-