Commit b29c0c55 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Fixed code formatting.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3500 b35dd754-fafc-0310-a699-88a17e54d16e
parent 6d57bd66
/** /**
* $RCSfile$ * $Revision$
* $Revision: $ * $Date$
* $Date: $
* *
* Copyright (C) 2005 Jive Software. All rights reserved. * Copyright (C) 2005 Jive Software. All rights reserved.
* *
...@@ -20,15 +19,15 @@ import javax.security.sasl.RealmCallback; ...@@ -20,15 +19,15 @@ import javax.security.sasl.RealmCallback;
import java.io.IOException; import java.io.IOException;
/** /**
* Callback handler that may be used when doing SASL authentication. A CallbackHandler may be * Callback handler that may be used when doing SASL authentication. A CallbackHandler
* required depending on the SASL mechanism being used. Currently DIGEST-MD5 and CRAM-MD5 are * may be required depending on the SASL mechanism being used. Currently DIGEST-MD5 and
* the only mechanisms that will require a callback handler.<p> * CRAM-MD5 are the only mechanisms that will require a callback handler.<p>
* *
* Mechanisms that use a digest don't include a password so the server needs to use the stored * Mechanisms that use a digest don't include a password so the server needs to use the
* password of the user to compare it (somehow) with the specified digest. This operation requires * stored password of the user to compare it (somehow) with the specified digest. This
* that the UserProvider being used supports passwords retrival. {@link SASLAuthentication} should * operation requires that the UserProvider being used supports passwords retrival.
* not offer these kind of SASL mechanisms if the user provider being in use does not support * {@link SASLAuthentication} should not offer these kind of SASL mechanisms if the user
* passwords retrieval. * provider being in use does not support passwords retrieval.
* *
* @author Hao Chen * @author Hao Chen
*/ */
...@@ -37,7 +36,8 @@ public class XMPPCallbackHandler implements CallbackHandler { ...@@ -37,7 +36,8 @@ public class XMPPCallbackHandler implements CallbackHandler {
public XMPPCallbackHandler() { public XMPPCallbackHandler() {
} }
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { public void handle(final Callback[] callbacks)
throws IOException, UnsupportedCallbackException {
String realm = null; String realm = null;
String name = null; String name = null;
...@@ -50,13 +50,15 @@ public class XMPPCallbackHandler implements CallbackHandler { ...@@ -50,13 +50,15 @@ public class XMPPCallbackHandler implements CallbackHandler {
realm = ((RealmCallback) callbacks[i]).getDefaultText(); realm = ((RealmCallback) callbacks[i]).getDefaultText();
} }
//Log.info("RealmCallback: " + realm); //Log.info("RealmCallback: " + realm);
} else if (callbacks[i] instanceof NameCallback) { }
else if (callbacks[i] instanceof NameCallback) {
name = ((NameCallback) callbacks[i]).getName(); name = ((NameCallback) callbacks[i]).getName();
if (name == null) { if (name == null) {
name = ((NameCallback) callbacks[i]).getDefaultName(); name = ((NameCallback) callbacks[i]).getDefaultName();
} }
//Log.info("NameCallback: " + name); //Log.info("NameCallback: " + name);
} else if (callbacks[i] instanceof PasswordCallback) { }
else if (callbacks[i] instanceof PasswordCallback) {
try { try {
// Get the password from the UserProvider. Some UserProviders may not support // Get the password from the UserProvider. Some UserProviders may not support
// this operation // this operation
...@@ -65,10 +67,12 @@ public class XMPPCallbackHandler implements CallbackHandler { ...@@ -65,10 +67,12 @@ public class XMPPCallbackHandler implements CallbackHandler {
//Log.info("PasswordCallback: " //Log.info("PasswordCallback: "
//+ new String(((PasswordCallback) callbacks[i]).getPassword())); //+ new String(((PasswordCallback) callbacks[i]).getPassword()));
} catch (UserNotFoundException e) { }
catch (UserNotFoundException e) {
throw new IOException(e.toString()); throw new IOException(e.toString());
} }
} else if (callbacks[i] instanceof AuthorizeCallback) { }
else if (callbacks[i] instanceof AuthorizeCallback) {
AuthorizeCallback authCallback = ((AuthorizeCallback) callbacks[i]); AuthorizeCallback authCallback = ((AuthorizeCallback) callbacks[i]);
String authenId = authCallback.getAuthenticationID(); String authenId = authCallback.getAuthenticationID();
String authorId = authCallback.getAuthorizationID(); String authorId = authCallback.getAuthorizationID();
...@@ -77,10 +81,10 @@ public class XMPPCallbackHandler implements CallbackHandler { ...@@ -77,10 +81,10 @@ public class XMPPCallbackHandler implements CallbackHandler {
authCallback.setAuthorizedID(authorId); authCallback.setAuthorizedID(authorId);
} }
//Log.info("AuthorizeCallback: authorId: " + authorId); //Log.info("AuthorizeCallback: authorId: " + authorId);
} else { }
else {
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback"); throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
} }
} }
} }
} }
\ No newline at end of file
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