2016-08-09 6 views
-1

Openfire 및 XMPP로 작업하고 있습니다. 내 문제는 : 누군가를 사인하고 싶을 때마다 Openfire에 로그인해야합니다.XMPP - 신규 사용자 등록

connection.login(Username, Password); 
      AccountManager accountManager = AccountManager.getInstance(connection); 
      accountManager.createAccount(Username1, Password1); 

이렇게 쓸모없는 로그인을 피하려면 어떻게해야합니까?

감사합니다.

답변

1

createAccount()에서 로그인 기능을 분리해야합니다.

당신은 (사용자와 암호를 제공하지 않고) 오픈 파이어에 연결해야, 다음의 createAccount

//...connection builder 
    connection.connect(); 
AccountManager.getInstance(connection).sensitiveOperationOverInsecureConnection(true); 
      username = username.toLowerCase(); 

       Map<String,String> attributes = new HashMap<String, String>(2); 
       attributes.put("name", fullName); 
       attributes.put("email", email); 
     AccountManager.getInstance(connection).createAccount(username, password, attributes); 
//now you can do connection.login(username,password) 
요청
관련 문제