노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


Openfire, 외부 Database연동

 

보유한 회원 정보를 활용하는 방법의 핵심적인 내용을 다룹니다.

 

 

기본 참조 글 : Step4 : Integrating Openfire with MySQL

 

이 예제는 웹사이트는 각 사용자의 저장된 정보를 저장하기위해 MySQL를 사용한다고

생각한다. Openfire는 외부 database와 통합(연동)될 수 있으며, 이 경우는 MySQL이다.

 

http://code.tutsplus.com/articles/create-a-flexible-xmpp-chat-for-a-member-based-website-with-flash-and-php--active-9858

 

1) 수정전의 openfire.xml

 

이 파일은 ${OpenfirHome}/conf/ 에 위치하고, 편집기등으로 수정 할 수 있다.

설치후에 Admin 설정을 통해서 기본 Database등이 생성이 되면, 아래와 같을 것 같다.

<?xml version="1.0" encoding="UTF-8"?>
<jive> 

  <adminConsole> 
    <port>9090</port>  
    <securePort>9091</securePort> 
  </adminConsole>  
  <locale>en</locale>

  <stream> 
    <management> 
      <active>true</active>  
      <requestFrequency>5</requestFrequency> 
    </management> 
  </stream>   
   
    org.jivesoftware.database.DefaultConnectionProvider 
    
  <database> 
  <defaultProvider> 
      <driver>org.postgresql.Driver</driver>  
      <serverURL>jdbc:postgresql://localhost:5432/openfire</serverURL>  
      <username encrypted="true">
dcc8c19832c8f0b244bd961d65b78992d7</username>  
      <password encrypted="true">
196a575f8b562224af43454639fe41e6fff7c2</password>  
      <testSQL>select 1</testSQL>  
      <testBeforeUse>false</testBeforeUse>  
      <testAfterUse>false</testAfterUse>  
      <minConnections>5</minConnections>  
      <maxConnections>25</maxConnections>  
      <connectionTimeout>1.0</connectionTimeout> 
  </defaultProvider>  
  </database> 
</jive>

 

2) ofUser(Table)를 대체할 nuser(Table)을 준비

 

기본 제공되는 사용자 정보 Table(ofUser)를 사용하지 않고, 기존 database를 사용

CREATE TABLE nuser
(
  id character varying(20) NOT NULL,
  company_cd character varying(30),
  division_cd character varying(50),
  pwd character varying(32),
  name character varying(30),
  email character varying(50),
  company_nm character varying(40),
  division_nm character varying(40),
  reg_date timestamp,
  CONSTRAINT nuser_pk PRIMARY KEY (id)
)

 

3) Admin Console

 

관리자 페이지내의  System Properties 링크를 클릭 하면, Property Name / Value가 볼 수 있다.

 

 

Add new property value

 

순서대로 아래 Name과 Value를 등록 한다.

 

 

1) jdbcProvider.driver

 

 

 

2) jdbcProvider.connectionString

 

jdbc:mysql://localhost/mycontentsite?user=root&password=xxxxx

 

3) provider.auth.className

 

org.jivesoftware.openfire.auth.JDBCAuthProvider

 

4) jdbcAuthProvider.passwordSQL

 

SELECT pwd FROM nuser WHERE id=?

 

5) jdbcAuthProvider.passwordType

 

md5

 

* jdbcAuthProvider의 Property Value는 hidden으로 보여준다.

 

 

6) admin.authorizedUsernames

 

janedoe@[the server's XMPP domain] ( ex) janedoe@abc.com )

 

7) provider.user.className

 

org.jivesoftware.openfire.user.JDBCUserProvider

 

8) jdbcUserProvicer.loadUserSQL

 

select name, email from nuser where id=?

 

9) jdbcUserProvider.userCountSQL

 

select count(*) from nuser

 

10) jdbcUserProvider.allUsersSQL

 

select id from nuser

 

11) usernameFiled

 

id

 

12) nameField

 

name

 

13) emailField

 

email

 



Admin Console를 로그아웃하고, Openfire를 재시작한다.

admin.authorizedUsernames에 등록된 사용자로 Admin Console에 접속이 된다면, 정상적으로 등록이 된것이다.

 

( openfire 4.0.2 버젼은 수정된 정보가 openfire.xml에 등록되지 않으며, ofProperty Table내에서 해당 정보들을 확인하고 수정이 가능하다.



 

일반 사용자들은 Spark등을 이용해서 새로운 user database정보로 접속 여부를 체크한다.

 

 

 

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,