Commit a5ae728b authored by Greg Thomas's avatar Greg Thomas

Ensure that LDAP configuration options are appropriately displayed

parent 23fa6f11
......@@ -131,6 +131,17 @@ public class AuthFactory {
return c.isInstance(authProvider);
}
/**
* Indicates if the currently-installed AuthProvider is the HybridAuthProvider supporting a specific class.
*
* @param clazz the class to check
* @return {@code true} if the currently-installed AuthProvider is a HybridAuthProvider that supports an instance of clazz, otherwise {@code false}.
*/
public static boolean isProviderHybridInstanceOf(Class<? extends AuthProvider> clazz) {
return authProvider instanceof HybridAuthProvider &&
((HybridAuthProvider) authProvider).isProvider(clazz);
}
/**
* Returns true if the currently installed {@link AuthProvider} supports password
* retrieval. Certain implementation utilize password hashes and other authentication
......
......@@ -249,4 +249,10 @@ public class HybridAuthProvider implements AuthProvider {
public String getStoredKey(String username) throws UnsupportedOperationException, UserNotFoundException {
throw new UnsupportedOperationException();
}
boolean isProvider(final Class<? extends AuthProvider> clazz) {
return (primaryProvider != null && clazz.isAssignableFrom(primaryProvider.getClass()))
|| (secondaryProvider != null && clazz.isAssignableFrom(secondaryProvider.getClass()))
||(tertiaryProvider != null && clazz.isAssignableFrom(tertiaryProvider.getClass()));
}
}
<%@ page import="org.jivesoftware.util.JiveGlobals" %>
<%@ page import="org.jivesoftware.openfire.ldap.LdapManager" %>
<%@ page import="org.jivesoftware.openfire.auth.AuthFactory" %>
<%@ page import="org.jivesoftware.openfire.ldap.LdapAuthProvider" %>
<%--
-
- Copyright (C) 2005-2008 Jive Software. All rights reserved.
......@@ -36,8 +38,8 @@
</head>
<body>
<%
boolean isLDAP = "org.jivesoftware.openfire.ldap.LdapAuthProvider".equals(
JiveGlobals.getProperty("provider.auth.className"));
boolean isLDAP = "org.jivesoftware.openfire.ldap.LdapAuthProvider".equals(JiveGlobals.getProperty("provider.auth.className"))
|| AuthFactory.isProviderHybridInstanceOf(LdapAuthProvider.class);
%>
<p>
<fmt:message key="profile-settings.info"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment