Package org.jivesoftware.openfire.admin
Class JDBCAdminProvider
- java.lang.Object
-
- org.jivesoftware.openfire.admin.JDBCAdminProvider
-
- All Implemented Interfaces:
AdminProvider
public class JDBCAdminProvider extends Object implements AdminProvider
The JDBC admin provider allows you to use an external database to define the administrators users. It is best used with the JDBCAuthProvider & JDBCGroupProvider to provide integration between your external system and Openfire. All data is treated as read-only so any set operations will result in an exception.To enable this provider, set the following in the system properties:
provider.admin.className = org.jivesoftware.openfire.admin.JDBCAdminProvider
jdbcProvider.driver = com.mysql.jdbc.DriverjdbcProvider.connectionString = jdbc:mysql://localhost/dbname?user=username&password=secretjdbcAdminProvider.getAdminsSQL = SELECT user FROM myAdmins
If you want to be able to update the admin users via the UI, add the following properties:
jdbcAdminProvider.insertAdminsSQL = INSERT INTO myAdmins (user) VALUES (?)jdbcAdminProvider.deleteAdminsSQL = DELETE FROM myAdmins WHERE user = ?
In order to use the configured JDBC connection provider do not use a JDBC connection string, set the following property
jdbcAdminProvider.useConnectionProvider = true
- Author:
- Robert Marcano
-
-
Constructor Summary
Constructors Constructor Description JDBCAdminProvider()Constructs a new JDBC admin provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanassumePersistedDataIsEscaped()XMPP disallows some characters in identifiers, requiring them to be escaped.List<org.xmpp.packet.JID>getAdmins()Returns a list of JIDs of accounts with administrative privileges.booleanisReadOnly()Indicates whether the admin list is read-only or not.voidsetAdmins(List<org.xmpp.packet.JID> newAdmins)Sets the list of admin accounts, by JID.
-
-
-
Method Detail
-
assumePersistedDataIsEscaped
protected boolean assumePersistedDataIsEscaped()
XMPP disallows some characters in identifiers, requiring them to be escaped. This implementation assumes that the database returns properly escaped identifiers, but can apply escaping by setting the value of the 'jdbcAdminProvider.isEscaped' property to 'false'.- Returns:
- 'false' if this implementation needs to escape database content before processing.
-
getAdmins
public List<org.xmpp.packet.JID> getAdmins()
Description copied from interface:AdminProviderReturns a list of JIDs of accounts with administrative privileges.- Specified by:
getAdminsin interfaceAdminProvider- Returns:
- The list of admin users.
-
setAdmins
public void setAdmins(List<org.xmpp.packet.JID> newAdmins)
Description copied from interface:AdminProviderSets the list of admin accounts, by JID.- Specified by:
setAdminsin interfaceAdminProvider- Parameters:
newAdmins- List of JIDs of accounts to grant admin access to.
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:AdminProviderIndicates whether the admin list is read-only or not. In other words, whether an admin can change who is an admin from the Openfire admin interface.- Specified by:
isReadOnlyin interfaceAdminProvider- Returns:
- True or false if the admin list can be edited.
-
-