Class PropertyBasedUserProviderMapper

  • All Implemented Interfaces:
    UserProviderMapper

    public class PropertyBasedUserProviderMapper
    extends Object
    implements UserProviderMapper
    A UserProviderMapper 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 an UserProvider to be used for this set: propertyBasedUserMapper.set.SET_NAME.provider.className Use the following property to identify a set of usernames: propertyBasedUserMapper.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 corresponding PropertyBasedAuthProviderMapper 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 property propertyBasedUserMapper.fallbackProvider.className. The following example defines two sets. Set "A" serves users john, jane and jack, and uses a DefaultUserProvider. Set "B" serves users dave and doris, and uses A JDBCUserProvider. All other users are served by the fallback provider that is a NativeUserProvider.
    • members.set.A = List( "john", "jane", "jack" )
    • members.set.B = List( "dave", "doris" )
    • propertyBasedUserMapper.set.A.provider.className = org.jivesoftware.openfire.user.DefaultUserProvider
    • propertyBasedUserMapper.set.A.members.propertyName = members.set.A
    • propertyBasedUserMapper.set.B.provider.className = org.jivesoftware.openfire.user.JDBCUserProvider
    • propertyBasedUserMapper.set.B.members.propertyName = members.set.B
    • propertyBasedUserMapper.fallbackProvider.className = org.jivesoftware.openfire.auth.NativeUserProvider
    Author:
    Guus der Kinderen, guus@goodbytes.nl
    • Constructor Detail

      • PropertyBasedUserProviderMapper

        public PropertyBasedUserProviderMapper()
    • Method Detail

      • getUserProvider

        public UserProvider getUserProvider​(String username)
        Description copied from interface: UserProviderMapper
        Finds a suitable UserProvider for the user. Note that the provided username need not reflect a pre-existing user (the instance might be used to determine in which provider a new user is to be created). Implementations are expected to be able to find a UserProvider for any username. If an implementation fails to do so, such a failure is assumed to be the result of a problem in implementation or configuration.
        Specified by:
        getUserProvider in interface UserProviderMapper
        Parameters:
        username - A user identifier (cannot be null or empty).
        Returns:
        A UserProvider for the user (never null).
      • getUserProviders

        public Set<UserProvider> getUserProviders()
        Description copied from interface: UserProviderMapper
        Returns all providers that are used by this instance. The returned collection should have a consistent, predictable iteration order.
        Specified by:
        getUserProviders in interface UserProviderMapper
        Returns:
        all providers (never null).