简体   繁体   中英

Openfire Custom Database Login

I'm trying to connect Openfire with my custom my sql database which I created using Mysql workbench..

I modified openfire.xml file as follow :

<jive> 
  <adminConsole> 
    <!-- Disable either port by setting the value to -1 -->  
    <port>9090</port>  
    <securePort>9091</securePort> 
  </adminConsole>  
  <locale>en</locale>  
  <!-- Network settings. By default, Openfire will bind to all network interfaces.
  Alternatively, you can specify a specific network interfaces that the server
  will listen on. For example, 127.0.0.1. This setting is generally only useful
   on multi-homed servers. -->  
  <!--
    <network>
        <interface></interface>
    </network>
    -->  
  <connectionProvider> 
    <className>org.jivesoftware.database.DefaultConnectionProvider</className> 
  </connectionProvider>  
  <database> 
    <defaultProvider> 
      <driver>com.mysql.jdbc.Driver</driver>  
      <serverURL>jdbc:mysql://localhost:3306/openfire_db?rewriteBatchedStatements=true</serverURL>  
      <username encrypted="true">c130d8786ef86071bcb73f1d8da0eb34f544f389f480f60e</username>  
      <password encrypted="true">f15df01c5d651451f5f38c29332cf655ff1621d7c0e741ec</password>  
      <testSQL>select 1</testSQL>  
      <testBeforeUse>false</testBeforeUse>  
      <testAfterUse>false</testAfterUse>  
      <minConnections>5</minConnections>  
      <maxConnections>25</maxConnections>  
      <connectionTimeout>1.0</connectionTimeout> 
    </defaultProvider> 
  </database>  
  <setup>true</setup>  
  <jdbcProvider> 
    <driver>com.mysql.jdbc.Driver</driver>  
    <connectionString>jdbc:mysql://localhost/openfire_db?user=root&amp;password=hello</connectionString> 
  </jdbcProvider>  
  <provider/>  
  <jdbcAuthProvider> 
     <passwordSQL>SELECT plainPassword FROM users WHERE username=?</passwordSQL>  
     <passwordType>plain</passwordType> 
  </jdbcAuthProvider>  
  <jdbcUserProvider> 
    <loadUserSQL>SELECT name,email FROM users WHERE username=?</loadUserSQL>  
    <userCountSQL>SELECT COUNT(*) FROM users</userCountSQL>  
    <allUsersSQL>SELECT username FROM users</allUsersSQL>  
    <searchSQL>SELECT username FROM users WHERE</searchSQL>  
    <usernameField>username</usernameField>  
    <nameField>name</nameField>  
    <emailField>email</emailField> 
  </jdbcUserProvider> 
 </jive>

I get no errors, no warns.. But when I try to login to the admin console I get :

Login failed: make sure your username and password are correct and that you're an admin or moderator.

And in warns:

2015.01.28 11:31:20 org.jivesoftware.admin.LoginLimitManager - Failed admin console login attempt by user from 127.0.0.1

I have in my database table users which has columns : username, plainPassword, encryptedPassword, name, email, creationDate

Thanks.. :)

Problem Solved ^_^.. I needed to add the following to openfire.xml :

<provider>
<auth>
  <className>org.jivesoftware.openfire.auth.JDBCAuthProvider</className>
</auth>
<user>
  <className>org.jivesoftware.openfire.user.JDBCUserProvider</className>
</user>
<group>
  <className>org.jivesoftware.openfire.group.JDBCGroupProvider</className>
</group>
</provider>

and change properties of ofProperty table..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM