如果手动一步步设置
删除默认,
首先停止正常运行的Openfire服务器
默认的库ofProperty的如下记录删除
provider.auth.classname
provider.user.classname
provider.group.classname
建立一个第三方的表
CREATE TABLE myUser (
username NVARCHAR(64) NOT NULL,
plainPassword NVARCHAR(32),
encryptedPassword NVARCHAR(255),
name NVARCHAR(100),
email VARCHAR(100),
creationDate CHAR(15) NOT NULL,
modificationDate CHAR(15) NOT NULL,
CONSTRAINT ofUser_pk PRIMARY KEY (username)
);
CREATE INDEX ofUser_cDate_idx ON myUser (creationDate ASC);
CREATE TABLE myGroupUser (
groupName NVARCHAR(50) NOT NULL,
username NVARCHAR(100) NOT NULL,
administrator INTEGER NOT NULL,
CONSTRAINT ofGroupUser_pk PRIMARY KEY (groupName, username, administrator)
);
CREATE TABLE myGroup (
groupName NVARCHAR(50) NOT NULL,
description NVARCHAR(255),
CONSTRAINT ofGroup_pk PRIMARY KEY (groupName)
);
密码加密方式:
plain md5 sha1 sha256 sha512
密码采用明文:
SELECT plainPassword FROM myUser WHERE username=?
palin
密码采用HASH:
SELECT encryptedPassword FROM myUser WHERE username=?
sha256
如下是一个myUser 中admin数据[myUser 插入admin/**数据,必须有一个,否则再次启动时使用这个验证时就没法登录]
admin
admin
8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
admin
Admin@demo.com
2011-1-1
2011-1-1
配置文件
openfire.xml 加入如下内容
net.sourceforge.jtds.jdbc.Driver
jdbc:jtds:sqlserver://localhost/cust;appName=cust;user=of;password=of
org.jivesoftware.openfire.auth.JDBCAuthProvider
org.jivesoftware.openfire.user.JDBCUserProvider
org.jivesoftware.openfire.group.JDBCGroupProvider
SELECT plainPassword FROM myUser WHERE username=?
palin
SELECT name,email FROM myUser WHERE username=?
SELECT COUNT(*) FROM myUser
SELECT username FROM myUser
SELECT username FROM myUser WHERE
username
name
SELECT count(*) FROM myGroup
SELECT groupName FROM myGroup
SELECT groupDescription FROM myGroup WHERE groupName=?
SELECT groupName FROM myGroupUser WHERE username=?
SELECT username FROM myGroupUser WHERE groupName=? AND isAdmin='N'
SELECT username FROM myGroupUser WHERE groupName=? AND isAdmin='Y'
启动
再次启动后,使用admin可以登录进去
默认的数据库的[ofProperty]内容从配置文件导入了,openfire.xml恢复原来的形式,查看ofProperty
name
propValue
jdbcAuthProvider.passwordSQL
SELECT plainPassword FROM myUser WHERE username=?
jdbcAuthProvider.passwordType
plain
jdbcGroupProvider.allGroupsSQL
SELECT groupName FROM myGroup
jdbcGroupProvider.descriptionSQL
SELECT groupDescription FROM myGroup WHERE groupName=?
jdbcGroupProvider.groupCountSQL
SELECT count(*) FROM myGroup
jdbcGroupProvider.loadAdminsSQL
SELECT username FROM myGroupUser WHERE groupName=? AND isAdmin='Y'
jdbcGroupProvider.loadMembersSQL
SELECT username FROM myGroupUser WHERE groupName=? AND isAdmin='N'
jdbcGroupProvider.userGroupsSQL
SELECT groupName FROM myGroupUser WHERE username=?
jdbcProvider.connectionString
jdbc:jtds:sqlserver://localhost/cust;appName=cust;user=of;password=of
jdbcProvider.driver
net.sourceforge.jtds.jdbc.Driver
jdbcUserProvider.allUsersSQL
SELECT username FROM myUser
jdbcUserProvider.emailField
jdbcUserProvider.loadUserSQL
SELECT name,email FROM myUser WHERE username=?
jdbcUserProvider.nameField
name
jdbcUserProvider.searchSQL
SELECT username FROM myUser WHERE
jdbcUserProvider.userCountSQL
SELECT COUNT(*) FROM myUser
jdbcUserProvider.usernameField
username
provider.auth.className
org.jivesoftware.openfire.auth.JDBCAuthProvider
provider.group.className
org.jivesoftware.openfire.group.JDBCGroupProvider
provider.user.className
org.jivesoftware.openfire.user.JDBCUserProvider