I'd also make the following changes.
Comments? The Test updates are optional, but may as well clean those up.
--kevan
coltrane:~/geronimo/server/trunk kevan$ svn diff
Index: testsuite/enterprise-testsuite/sec-tests/sec-ejb/src/main/java/
org/apache/geronimo/itest/TestLoginModule.java
===================================================================
--- testsuite/enterprise-testsuite/sec-tests/sec-ejb/src/main/java/
org/apache/geronimo/itest/TestLoginModule.java (revision 565610)
+++ testsuite/enterprise-testsuite/sec-tests/sec-ejb/src/main/java/
org/apache/geronimo/itest/TestLoginModule.java (working copy)
@@ -69,7 +69,10 @@
}
user = ((NameCallback)callbacks[0]).getName();
String password = new String(((PasswordCallback)callbacks
[1]).getPassword());
- return user.equals(password) && users.contains(user);
+ if (user.equals(password) && users.contains(user)) {
+ return true;
+ }
+ throw new LoginException();
}
public boolean commit() throws LoginException {
Index: modules/geronimo-security/src/main/java/org/apache/geronimo/
security/jaas/UPCredentialLoginModule.java
===================================================================
--- modules/geronimo-security/src/main/java/org/apache/geronimo/
security/jaas/UPCredentialLoginModule.java (revision 565610)
+++ modules/geronimo-security/src/main/java/org/apache/geronimo/
security/jaas/UPCredentialLoginModule.java (working copy)
@@ -72,7 +72,7 @@
String username = ((NameCallback) callbacks[0]).getName();
char[] password = ((PasswordCallback) callbacks
[1]).getPassword();
- if (username == null || password == null) return true;
+ if (username == null || password == null) return false;
upCredential = new UsernamePasswordCredential(username,
password);
Index: modules/geronimo-connector/src/main/java/org/apache/geronimo/
connector/outbound/security/
CallerIdentityPasswordCredentialLoginModule.java
===================================================================
--- modules/geronimo-connector/src/main/java/org/apache/geronimo/
connector/outbound/security/
CallerIdentityPasswordCredentialLoginModule.java (revision 565610)
+++ modules/geronimo-connector/src/main/java/org/apache/geronimo/
connector/outbound/security/
CallerIdentityPasswordCredentialLoginModule.java (working copy)
@@ -81,10 +81,13 @@
resourcePrincipalName = ((NameCallback) callbacks
[0]).getName();
userName = ((NameCallback) callbacks[0]).getName();
password = ((PasswordCallback) callbacks[1]).getPassword();
- return resourcePrincipalName != null && userName != null &&
password != null;
+ return false;
}
public boolean commit() throws LoginException {
+ if (resourcePrincipalName == null || userName == null ||
password == null) {
+ throw new LoginException();
+ }
subject.getPrincipals().add(new ResourcePrincipal
(resourcePrincipalName));
PasswordCredential passwordCredential = new
PasswordCredential(userName, password);
passwordCredential.setManagedConnectionFactory
(managedConnectionFactory);
Index: modules/geronimo-jmx-remoting/src/test/java/org/apache/
geronimo/jmxremoting/AuthenticatorTest.java
===================================================================
--- modules/geronimo-jmx-remoting/src/test/java/org/apache/geronimo/
jmxremoting/AuthenticatorTest.java (revision 565610)
+++ modules/geronimo-jmx-remoting/src/test/java/org/apache/geronimo/
jmxremoting/AuthenticatorTest.java (working copy)
@@ -112,7 +112,10 @@
if (password == null) {
throw new FailedLoginException();
}
- return password.equals(new String
(passwordCallback.getPassword()));
+ if (password.equals(new String
(passwordCallback.getPassword()))) {
+ return true;
+ }
+ throw new FailedLoginException();
} catch (java.io.IOException e) {
throw new FailedLoginException();
} catch (UnsupportedCallbackException e) {
|