class AuthorizationBasedAuthProviderMapper implements AuthProviderMapper
{
    /**
     * Name of the property of which the value is expected to be the classname of the AuthProvider which will serve the
     * administrative users.
     */
    public static final String PROPERTY_ADMINPROVIDER_CLASSNAME = "authorizationBasedAuthMapper.adminProvider.className";

    /**
     * Name of the property of which the value is expected to be the classname of the AuthProvider which will serve the
     * regular, non-administrative users.
     */
    public static final String PROPERTY_USERPROVIDER_CLASSNAME = "authorizationBasedAuthMapper.userProvider.className";

    /**
     * Serves the administrative users.
     */
    protected final AuthProvider adminProvider;

    /**
     * Serves the regular, non-administrative users.
     */
    protected final AuthProvider userProvider;

    public AuthorizationBasedAuthProviderMapper()
    {
        // Migrate properties.
        JiveGlobals.migrateProperty( PROPERTY_ADMINPROVIDER_CLASSNAME );
        JiveGlobals.migrateProperty( PROPERTY_USERPROVIDER_CLASSNAME );

        // Instantiate providers.
        adminProvider = instantiateProvider( PROPERTY_ADMINPROVIDER_CLASSNAME );
        userProvider = instantiateProvider( PROPERTY_USERPROVIDER_CLASSNAME );
    }

    protected static AuthProvider instantiateProvider( String propertyName )
    {<FILL_FUNCTION_BODY>}

    @Override
    public AuthProvider getAuthProvider( String username )
    {
        // TODO add optional caching, to prevent retrieving the administrative users upon every invocation.
        final JID jid = XMPPServer.getInstance().createJID( username, null );
        final boolean isAdmin = AdminManager.getAdminProvider().getAdmins().contains( jid );

        if ( isAdmin )
        {
            return adminProvider;
        } else
        {
            return userProvider;
        }
    }

    @Override
    public Set<AuthProvider> getAuthProviders()
    {
        final Set<AuthProvider> result = new LinkedHashSet<>();
        result.add( adminProvider );
        result.add( userProvider );

        return result;
    }
}

        final String className = JiveGlobals.getProperty( propertyName );
        if ( className == null )
        {
            throw new IllegalStateException( "A class name must be specified via openfire.xml or the system properties." );
        }

        try
        {
            final Class c = ClassUtils.forName( className );
            return (AuthProvider) c.newInstance();
        }
        catch ( Exception e )
        {
            throw new IllegalStateException( "Unable to create new instance of AuthProvider: " + className, e );
        }
    
<no_super_class>