当前位置:网站首页>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 .边栏推荐
- Web automation tool selection
- 视频号如何下载视频?来看超简单方法!
- 基于 Apache APISIX 的自动化运维平台
- RT thread thread synchronization and thread communication
- Leetcode daily question - 30 Concatenate substrings of all words
- QT how the coordinates of one control are relatively fixed and displayed on another control (coordinate system)
- Mongodb - replica set and sharding
- Bitbucket failed to pull the warehouse Using SSH
- Application of the purple book p113map of ananagrams (uva156)
- LeetCode116. 填充每个节点的下一个右侧节点指针
猜你喜欢

【激活函数】

【笔记:模拟MOS集成电路】带隙基准(基本原理+电流模+电压模电路详解)

Ehcache configuration data, convenient for self checking

I almost ran away

How to analyze the relationship between enterprise digital transformation and data asset management?
![[try to hack] cobalt strike (I)](/img/2b/5d274078b7d7ebd05b7c6d9e020868.png)
[try to hack] cobalt strike (I)

Learning Tai Chi Maker - mqtt Chapter II (VII) esp8266 mqtt Testament application

题解 Pie(POJ3122)超详细易懂的二分入门

LeetCode每日一题——515. 在每个树行中找最大值

力扣树的进一步应用
随机推荐
Leetcode daily question - 515 Find the maximum value in each tree row
Application of Andy s first dictionary (uva10815) Purple Book p112set
Recommend two high-quality Wallpaper software
What is an interface? What is interface testing?
LeetCode每日一题——剑指 Offer II 091. 粉刷房子
Understanding of incomplete types
LeetCode每日一题——710. 黑名单中的随机数
视频号如何下载视频?来看超简单方法!
LeetCode226. Flip binary tree
GlobalSign的泛域名SSL证书
Automatic operation and maintenance platform based on Apache APIs
在哪个软件上开户比较安全,开户流程是什么?
I almost ran away
嵌入式中 动态阿拉伯语字符串 转换 LCD显示字符串【感谢建国雄心】
LeetCode188. 买卖股票的最佳时机IV
Leetcode daily question - 324 Swing sort II
An artifact extracted from a well-known software and paid by a group of people
LeetCode122. 买卖股票的最佳时机II
穩定性總結
QT how the coordinates of one control are relatively fixed and displayed on another control (coordinate system)