You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2007/08/29 05:18:02 UTC
svn commit: r570625 -
/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientLoginModule.java
Author: dblevins
Date: Tue Aug 28 20:18:02 2007
New Revision: 570625
URL: http://svn.apache.org/viewvc?rev=570625&view=rev
Log:
Add support for specifying the realmName or a separator so the realmName can be included in the user name
Modified:
openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientLoginModule.java
Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientLoginModule.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientLoginModule.java?rev=570625&r1=570624&r2=570625&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientLoginModule.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ClientLoginModule.java Tue Aug 28 20:18:02 2007
@@ -41,6 +41,8 @@
private String user;
private Object clientIdentity;
private ClientIdentityPrincipal principal;
+ private String realmNameSeparator;
+ private String realmName;
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
this.subject = subject;
@@ -56,6 +58,14 @@
if (debug) {
log.config("Initialized ClientLoginModule: debug=" + debug);
}
+
+ if (options.containsKey("RealmNameSeparator")){
+ realmNameSeparator = (String)options.get("RealmNameSeparator");
+ }
+
+ if (options.containsKey("RealmName")){
+ realmName = (String)options.get("RealmName");
+ }
}
public boolean login() throws LoginException {
@@ -91,7 +101,19 @@
char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword();
if (tmpPassword == null) tmpPassword = new char[0];
- clientIdentity = ClientSecurity.directAuthentication(user, new String(tmpPassword), server);
+ if (realmNameSeparator != null){
+ String[] strings = user.split(realmNameSeparator);
+ if (strings.length == 2){
+ realmName = strings[0];
+ user = strings[1];
+ }
+ }
+
+ if (realmName != null) {
+ clientIdentity = ClientSecurity.directAuthentication(realmName, user, new String(tmpPassword), server);
+ } else {
+ clientIdentity = ClientSecurity.directAuthentication(user, new String(tmpPassword), server);
+ }
if (debug) {
log.config("login " + user);