当前位置:网站首页>Openfire user and group relationship migration
Openfire user and group relationship migration
2022-06-28 21:21:00 【Brother Xing plays with the clouds】
modify openfire There are two ways to configure : 1: Modify the installation directory /conf/openfire.xml. 2: Directly modifying openfire Database ofProperty surface . But it is generally recommended to modify openfire.xml file , If the file is configured correctly ,openfire After restart, the attribute values in the file will be automatically written to ofProperty surface , At the same time, the configuration you added will be erased , Only labels left ( In addition to the default configuration ). Pictured :
Corresponding ofProperty Table configuration :
Instructions provided on the official website , There are a few things you should pay attention to when transplanting ( All of the following are in openfire.xml It's equipped with ) 1: The official website provides information about the database configuration of your users and groups :
<jive> <jdbcProvider> <driver>com.mysql.jdbc.Driver</driver> <connectionString>jdbc:mysql://localhost/dbname?user=username&password=secret</connectionString> </jdbcProvider> </jive>
The user name and password inside should be added & Can't forget , After the configuration is successful , stay ofProperty The table will revert to &, Do not change the table to &
2: The official website provides the configuration of user login and admin Configuration of :<jive> <admin> <authorizedUsernames>joe, jane</authorizedUsernames> </admin> <provider> <auth> <className>org.jivesoftware.openfire.auth.JDBCAuthProvider</className> </auth> </provider> <jdbcAuthProvider> <passwordSQL>SELECT password FROM user_account WHERE username=?</passwordSQL> <passwordType>plain</passwordType> </jdbcAuthProvider> </jive>
Be careful : At this time, the users who log in to the web page are no longer openfire Self contained ofUser Users in the table , It is user_account Users of the table , This table is your own user table , Pay attention here :
Not in select password Add fields later .
3: User configuration provided on the official website :<jive> <provider> <auth> <className>org.jivesoftware.openfire.auth.JDBCAuthProvider</className> </auth> <user> <className>org.jivesoftware.openfire.user.JDBCUserProvider</className> </user> </provider> <jdbcAuthProvider> <passwordSQL>SELECT password FROM user_account WHERE username=?</passwordSQL> <passwordType>plain</passwordType> </jdbcAuthProvider> <jdbcUserProvider> <loadUserSQL>SELECT name,email FROM myUser WHERE username=?</loadUserSQL> <userCountSQL>SELECT COUNT(*) FROM myUser</userCountSQL> <allUsersSQL>SELECT username FROM myUser</allUsersSQL> <searchSQL>SELECT username FROM myUser WHERE</searchSQL> <usernameField>username</usernameField> <nameField>name</nameField> <emailField>email</emailField> </jdbcUserProvider> </jive>
Be careful :select The following fields should not be added randomly , such as <loadUserSQL>SELECT name,email FROM myUser WHERE username=?</loadUserSQL>
When I test, I remove email, Query only name, As a result, users are always unable to log on to the web , Look at the op The source code in JDBCUserProvider Class has the following paragraph :1 public User loadUser(String username) throws UserNotFoundException { 2 if(username.contains("@")) { 3 if (!XMPPServer.getInstance().isLocal(new JID(username))) { 4 thrownew UserNotFoundException("Cannot load user of remote server: "+ username); 5 } 6 username = username.substring(0,username.lastIndexOf("@")); 7 } 8 Connection con =null; 9 PreparedStatement pstmt =null; 10 ResultSet rs =null; 11 try { 12 con = getConnection(); 13 pstmt = con.prepareStatement(loadUserSQL); 14 pstmt.setString(1, username); 15 rs = pstmt.executeQuery(); 16 if (!rs.next()) { 17 thrownew UserNotFoundException(); 18 } 19 String name = rs.getString(1); 20 String email = rs.getString(2); 21 22 returnnew User(username, name, email, new Date(), new Date()); 23 } 24 catch (Exception e) { 25 thrownew UserNotFoundException(e); 26 } 27 finally { 28 DbConnectionManager.closeConnection(rs, pstmt, con); 29 } 30 }
The code goes to 20 An error is reported when the line is OK , Because of the inquiry sql barring email, There is no in the result set email Field , therefore rs.getString(2) I made a mistake .
So don't increase or decrease easily according to experience select Later fields , without select Later fields , There are only two ways. One is to modify op Source code , One is to modify your own business table , increase op Fields required for query .
4: Single user and group configurations provided on the official website :<jive> <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> <jdbcAuthProvider> <passwordSQL>SELECT password FROM user_account WHERE username=?</passwordSQL> <passwordType>plain</passwordType> </jdbcAuthProvider> <jdbcUserProvider> <loadUserSQL>SELECT name,email FROM myUser WHERE username=?</loadUserSQL> <userCountSQL>SELECT COUNT(*) FROM myUser</userCountSQL> <allUsersSQL>SELECT username FROM myUser</allUsersSQL> <searchSQL>SELECT username FROM myUser WHERE</searchSQL> <usernameField>username</usernameField> <nameField>name</nameField> <emailField>email</emailField> </jdbcUserProvider> <jdbcGroupProvider> <groupCountSQL>SELECT count(*) FROM myGroups</groupCountSQL> <allGroupsSQL>SELECT groupName FROM myGroups</allGroupsSQL> <userGroupsSQL>SELECT groupName FROM myGroupUsers WHERE username=?</userGroupsSQL> <descriptionSQL>SELECT groupDescription FROM myGroups WHERE groupName=?</descriptionSQL> <loadMembersSQL>SELECT username FROM myGroupUsers WHERE groupName=? AND isAdmin='N'</loadMembersSQL> <loadAdminsSQL>SELECT username FROM myGroupUsers WHERE groupName=? AND isAdmin='Y'</loadAdminsSQL> </jdbcGroupProvider>
</jive>
Be careful : Don't add or delete easily select Later fields , You can modify it according to your own business table .sql Don't write wrong , Otherwise, you cannot display your users and groups .
When an unknown error occurs , Get into logs Catalog view error.log Conduct adjustment test .边栏推荐
- Application practice | 1billion data second level correlation. Huolala's OLAP System Evolution Based on Apache Doris (with PPT download)
- LeetCode986. Intersection of interval lists
- Résumé de la stabilité
- 2. integrate filter
- Definition and precautions of genuine St link/v2 j-link jtag/swd pin
- LeetCode123. The best time to buy and sell stocks III
- Openfire 3.8.2 cluster configuration
- On the complexity of software development and the way to improve its efficiency
- Learn Tai Chi maker mqtt Chapter 2 (VIII) esp8266 mqtt user password authentication
- LeetCode986. 区间列表的交集
猜你喜欢

User network model and QoE

Application practice | 1billion data second level correlation. Huolala's OLAP System Evolution Based on Apache Doris (with PPT download)

我也差点“跑路”
![[Note: circuit intégré MOS analogique] référence de bande Gap (principe de base + mode courant + circuit en mode tension)](/img/cd/be62272d465ca990456c222b38df67.png)
[Note: circuit intégré MOS analogique] référence de bande Gap (principe de base + mode courant + circuit en mode tension)

I almost ran away

Study on bifunctional crosslinker lumiprobe sulfoacyanine 7 dicarboxylic acid

Alist+raidrive gives the computer a complete 8billion GB hard disk drive

Ehcache配置资料,方便自己查

Figure neural network can also be used as CV backbone model. Huawei Noah Vig architecture is comparable to CNN and transformer

【筆記:模擬MOS集成電路】帶隙基准(基本原理+電流模+電壓模電路詳解)
随机推荐
Openfire 3.8.2 cluster configuration
Study on bifunctional crosslinker lumiprobe sulfoacyanine 7 dicarboxylic acid
Learning Tai Chi Maker - mqtt Chapter II (VII) esp8266 mqtt Testament application
Leetcode daily question - 710 Random numbers in the blacklist
How to use dataant to monitor Apache apisex
接口测试流程
Leetcode: merge K ascending linked lists_ twenty-three
LeetCode116. Populate the next right node pointer for each node
Biovendor free light chain( κ and λ) Test steps of ELISA Kit
Usage example of qjsonobject
如何使用 DataAnt 监控 Apache APISIX
Explanation of memory dump triggered by software watchdog and anr
Deep interpretation of WiFi security vulnerability krack
How to do a good job in customer's successful bottom design | tob Master Course
LeetCode每日一题——剑指 Offer II 091. 粉刷房子
Web自动化工具选择
图神经网络也能用作CV骨干模型,华为诺亚ViG架构媲美CNN、Transformer
LeetCode226. 翻转二叉树
Leetcode: merge two ordered linked lists_ twenty-one
On the complexity of software development and the way to improve its efficiency