Author: rareddy
Date: 2010-06-07 12:50:55 -0400 (Mon, 07 Jun 2010)
New Revision: 2187
Modified:
trunk/common-core/src/main/java/org/teiid/core/CoreConstants.java
trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
Log:
TEIID-1110: fixing the NPE in the case that no user name and password supplied. If the
user name is not supplied it is assumed as 'anonymous'
Modified: trunk/common-core/src/main/java/org/teiid/core/CoreConstants.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/CoreConstants.java 2010-06-07 16:27:14
UTC (rev 2186)
+++ trunk/common-core/src/main/java/org/teiid/core/CoreConstants.java 2010-06-07 16:50:55
UTC (rev 2187)
@@ -106,7 +106,7 @@
/**
* Constant for the anonymous Teiid system username
*/
- public static final String DEFAULT_ANON_USERNAME = "teiidanonymous";
+ public static final String DEFAULT_ANON_USERNAME = "anonymous";
//$NON-NLS-1$
}
Modified: trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java 2010-06-07
16:27:14 UTC (rev 2186)
+++ trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java 2010-06-07
16:50:55 UTC (rev 2187)
@@ -57,12 +57,11 @@
private String securitydomain;
private Object credentials;
- public void authenticateUser(String username, Credentials credential, String
applicationName, List<String> domains) throws LoginException {
+ public void authenticateUser(String username, final Credentials credential, String
applicationName, List<String> domains) throws LoginException {
LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[]
{"authenticateUser", username, applicationName}); //$NON-NLS-1$
final String baseUsername = getBaseUsername(username);
- final char[] password = credential.getCredentialsAsCharArray();
// If username specifies a domain (user@domain) only that domain is authenticated
against.
// If username specifies no domain, then all domains are tried in order.
@@ -78,6 +77,10 @@
nc.setName(baseUsername);
} else if (callbacks[i] instanceof PasswordCallback) {
PasswordCallback pc = (PasswordCallback)callbacks[i];
+ char[] password = null;
+ if (credential != null) {
+ password = credential.getCredentialsAsCharArray();
+ }
pc.setPassword(password);
credentials = password;
} else {
Show replies by date