Author: david.lloyd(a)jboss.com
Date: 2008-02-21 10:38:16 -0500 (Thu, 21 Feb 2008)
New Revision: 3464
Modified:
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java
Log:
Use 'password' verifier mode by default; fix bug where authentication always
fails; clean up error messages
Modified:
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
===================================================================
---
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-02-21
15:17:59 UTC (rev 3463)
+++
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-02-21
15:38:16 UTC (rev 3464)
@@ -194,6 +194,7 @@
defaultProps.put(Sasl.POLICY_NODICTIONARY, "true");
defaultProps.put(Sasl.POLICY_NOACTIVE, "true");
defaultProps.put(Sasl.QOP, "auth-conf");
+ defaultProps.put("org.jboss.cx.remoting.sasl.srp.verifier",
"password");
return defaultProps;
}
@@ -208,13 +209,14 @@
if (callback instanceof NameCallback) {
((NameCallback)callback).setName("anonymous");
} else if (callback instanceof PasswordCallback) {
- ((PasswordCallback)callback).setPassword(new char[0]);
+
((PasswordCallback)callback).setPassword("password".toCharArray());
} else if (callback instanceof RealmCallback) {
continue;
} else if (callback instanceof AuthorizeCallback) {
((AuthorizeCallback)callback).setAuthorized(true);
+ } else {
+ throw new UnsupportedCallbackException(callback, "Default
anonymous server callback handler cannot support this callback type: " +
callback.getClass().getName());
}
- throw new UnsupportedCallbackException(callback, "Default
anonymous server callback handler cannot support this callback type");
}
}
};
@@ -231,11 +233,11 @@
if (callback instanceof NameCallback) {
((NameCallback)callback).setName("anonymous");
} else if (callback instanceof PasswordCallback) {
- ((PasswordCallback)callback).setPassword(new char[0]);
+
((PasswordCallback)callback).setPassword("password".toCharArray());
} else if (callback instanceof RealmCallback) {
((RealmCallback)callback).setText("default");
} else {
- throw new UnsupportedCallbackException(callback, "Default
anonymous client callback handler cannot support this callback type");
+ throw new UnsupportedCallbackException(callback, "Default
anonymous client callback handler cannot support this callback type: " +
callback.getClass().getName());
}
}
}
Modified:
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java
===================================================================
---
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java 2008-02-21
15:17:59 UTC (rev 3463)
+++
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java 2008-02-21
15:38:16 UTC (rev 3464)
@@ -155,7 +155,7 @@
throw new SaslException("Callback handler provided an empty value
for SRP password");
}
} catch (Exception e) {
- throw new SaslException("Failed to handle callbacks for SRP", e);
+ throw new SaslException("Failed to handle callbacks for SRP: " +
e.getMessage(), e);
}
if (authorizationId == null) {
authorizationId = "";
Modified:
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java
===================================================================
---
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java 2008-02-21
15:17:59 UTC (rev 3463)
+++
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java 2008-02-21
15:38:16 UTC (rev 3464)
@@ -227,13 +227,13 @@
// Catch this first, because SaslException extends IOException
throw e;
} catch (IOException e) {
- throw new SaslException("Failed to handle callbacks for SRP", e);
+ throw new SaslException("Authentication failed (I/O exception: " +
e.getMessage() + ")", e);
} catch (UnsupportedCallbackException e) {
- throw new SaslException("Failed to handle callbacks for SRP (unsupported
callback type)", e);
+ throw new SaslException("Authentication failed (callback unsupported:
" + e.getMessage() + ")", e);
} catch (NoSuchAlgorithmException e) {
- throw new SaslException("Failed to handle callbacks for SRP (no such
algorithm)", e);
+ throw new SaslException("Authentication failed (no such algorithm:
" + e.getMessage() + ")", e);
} catch (Base64DecodingException e) {
- throw new SaslException("Failed to handle callbacks for SRP (Base64
decode failed)", e);
+ throw new SaslException("Authentication failed (Base64 decode failed:
" + e.getMessage() + ")", e);
}
final BigInteger N = verifier.getSafePrime();
@@ -372,9 +372,9 @@
} catch (SaslException e) {
throw e;
} catch (IOException e) {
- throw new SaslException("Authorization failed (I/O exception)",
e);
+ throw new SaslException("Authorization failed (I/O exception: " +
e.getMessage() + ")", e);
} catch (UnsupportedCallbackException e) {
- throw new SaslException("Authorization failed (callback
unsupported)", e);
+ throw new SaslException("Authorization failed (callback unsupported:
" + e.getMessage() + ")", e);
}
authorizationId = authorizeCallback.getAuthorizedID();
if (authorizationId == null || ! authorizeCallback.isAuthorized()) {
Show replies by date