Commit 06ffffd5 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Event resource_bound is now triggered when using iq:auth. JM-1324

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10212 b35dd754-fafc-0310-a699-88a17e54d16e
parent 597e98e9
...@@ -19,6 +19,7 @@ import org.jivesoftware.openfire.*; ...@@ -19,6 +19,7 @@ import org.jivesoftware.openfire.*;
import org.jivesoftware.openfire.auth.AuthFactory; import org.jivesoftware.openfire.auth.AuthFactory;
import org.jivesoftware.openfire.auth.AuthToken; import org.jivesoftware.openfire.auth.AuthToken;
import org.jivesoftware.openfire.auth.UnauthorizedException; import org.jivesoftware.openfire.auth.UnauthorizedException;
import org.jivesoftware.openfire.event.SessionEventDispatcher;
import org.jivesoftware.openfire.session.ClientSession; import org.jivesoftware.openfire.session.ClientSession;
import org.jivesoftware.openfire.session.LocalClientSession; import org.jivesoftware.openfire.session.LocalClientSession;
import org.jivesoftware.openfire.session.Session; import org.jivesoftware.openfire.session.Session;
...@@ -58,7 +59,6 @@ import java.util.List; ...@@ -58,7 +59,6 @@ import java.util.List;
public class IQAuthHandler extends IQHandler implements IQAuthInfo { public class IQAuthHandler extends IQHandler implements IQAuthInfo {
private boolean anonymousAllowed; private boolean anonymousAllowed;
private boolean iqAuthAllowed;
private Element probeResponse; private Element probeResponse;
private IQHandlerInfo info; private IQHandlerInfo info;
...@@ -102,6 +102,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo { ...@@ -102,6 +102,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
return reply; return reply;
} }
IQ response; IQ response;
boolean resourceBound = false;
if (JiveGlobals.getBooleanProperty("xmpp.auth.iqauth",true)) { if (JiveGlobals.getBooleanProperty("xmpp.auth.iqauth",true)) {
try { try {
Element iq = packet.getElement(); Element iq = packet.getElement();
...@@ -127,6 +128,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo { ...@@ -127,6 +128,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
if (query.elements().isEmpty()) { if (query.elements().isEmpty()) {
// Anonymous authentication // Anonymous authentication
response = anonymousLogin(session, packet); response = anonymousLogin(session, packet);
resourceBound = session.getStatus() == Session.STATUS_AUTHENTICATED;
} }
else { else {
String username = query.elementTextTrim("username"); String username = query.elementTextTrim("username");
...@@ -144,6 +146,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo { ...@@ -144,6 +146,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
else { else {
// it is an auth attempt // it is an auth attempt
response = login(username, query, packet, password, session, digest); response = login(username, query, packet, password, session, digest);
resourceBound = session.getStatus() == Session.STATUS_AUTHENTICATED;
} }
} }
} }
...@@ -168,6 +171,10 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo { ...@@ -168,6 +171,10 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
// to the correct session. Any other session of the same user but with different // to the correct session. Any other session of the same user but with different
// resource is incorrect. // resource is incorrect.
session.process(response); session.process(response);
if (resourceBound) {
// After the client has been informed, inform all listeners as well.
SessionEventDispatcher.dispatchEvent(session, SessionEventDispatcher.EventType.resource_bound);
}
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment