1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-16 12:12:06 +01:00

Fixed SASL authentication that required a realm like DIGEST-MD5.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@10429 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2008-05-23 00:42:16 +00:00 committed by gato
parent d23d36974f
commit babc992e11

View file

@ -59,6 +59,7 @@ public abstract class SASLMechanism implements CallbackHandler {
protected SaslClient sc;
protected String authenticationId;
protected String password;
protected String hostname;
public SASLMechanism(SASLAuthentication saslAuthentication) {
@ -83,6 +84,7 @@ public abstract class SASLMechanism implements CallbackHandler {
//Set the authenticationID as the username, since they must be the same in this case.
this.authenticationId = username;
this.password = password;
this.hostname = host;
String[] mechanisms = { getName() };
Map<String,String> props = new HashMap<String,String>();
@ -115,7 +117,7 @@ public abstract class SASLMechanism implements CallbackHandler {
if(sc.hasInitialResponse()) {
byte[] response = sc.evaluateChallenge(new byte[0]);
String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
if(authenticationText != null && !authenticationText.equals("")) {
if(authenticationText != null && !authenticationText.equals("")) {
stanza.append(authenticationText);
}
}
@ -184,8 +186,8 @@ public abstract class SASLMechanism implements CallbackHandler {
PasswordCallback pcb = (PasswordCallback)callbacks[i];
pcb.setPassword(password.toCharArray());
} else if(callbacks[i] instanceof RealmCallback) {
//unused
//RealmCallback rcb = (RealmCallback)callbacks[i];
RealmCallback rcb = (RealmCallback)callbacks[i];
rcb.setText(hostname);
} else if(callbacks[i] instanceof RealmChoiceCallback){
//unused
//RealmChoiceCallback rccb = (RealmChoiceCallback)callbacks[i];