activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r379619 [24/30] - in /incubator/activemq/trunk: ./ activecluster/ activecluster/src/java/org/apache/activecluster/ activecluster/src/java/org/apache/activecluster/election/ activecluster/src/java/org/apache/activecluster/election/impl/ acti...
Date Tue, 21 Feb 2006 23:14:17 GMT
Modified: incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/LDAPLoginModule.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/LDAPLoginModule.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/LDAPLoginModule.java (original)
+++ incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/LDAPLoginModule.java Tue Feb 21 15:12:56 2006
@@ -1,397 +1,397 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.jaas;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import javax.naming.AuthenticationException;
-import javax.naming.CommunicationException;
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.login.FailedLoginException;
-import javax.security.auth.spi.LoginModule;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-
-/**
- * @version $Rev: $ $Date: $
- */
-public class LDAPLoginModule implements LoginModule {
-
-    private static Log log = LogFactory.getLog(LDAPLoginModule.class);
-
-    private Subject subject;
-    private CallbackHandler handler;
-
-    private static final String INITIAL_CONTEXT_FACTORY = "initialContextFactory";
-    private static final String CONNECTION_URL = "connectionURL";
-    private static final String CONNECTION_USERNAME = "connectionUsername";
-    private static final String CONNECTION_PASSWORD = "connectionPassword";
-    private static final String CONNECTION_PROTOCOL = "connectionProtocol";
-    private static final String AUTHENTICATION = "authentication";
-    private static final String USER_BASE = "userBase";
-    private static final String USER_SEARCH_MATCHING = "userSearchMatching";
-    private static final String USER_SEARCH_SUBTREE = "userSearchSubtree";
-    private static final String ROLE_BASE = "roleBase";
-    private static final String ROLE_NAME = "roleName";
-    private static final String ROLE_SEARCH_MATCHING = "roleSearchMatching";
-    private static final String ROLE_SEARCH_SUBTREE = "roleSearchSubtree";
-    private static final String USER_ROLE_NAME = "userRoleName";
-
-    private String initialContextFactory;
-    private String connectionURL;
-    private String connectionUsername;
-    private String connectionPassword;
-    private String connectionProtocol;
-    private String authentication;
-    private String userBase;
-    private String roleBase;
-    private String roleName;
-    private String userRoleName;
-
-    private String username;
-
-    protected DirContext context = null;
-
-    private MessageFormat userSearchMatchingFormat;
-    private MessageFormat roleSearchMatchingFormat;
-
-    private boolean userSearchSubtreeBool = false;
-    private boolean roleSearchSubtreeBool = false;
-
-    Set groups = new HashSet();
-
-    public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
-        this.subject = subject;
-        this.handler = callbackHandler;
-        initialContextFactory = (String) options.get(INITIAL_CONTEXT_FACTORY);
-        connectionURL = (String) options.get(CONNECTION_URL);
-        connectionUsername = (String) options.get(CONNECTION_USERNAME);
-        connectionPassword = (String) options.get(CONNECTION_PASSWORD);
-        connectionProtocol = (String) options.get(CONNECTION_PROTOCOL);
-        authentication = (String) options.get(AUTHENTICATION);
-        userBase = (String) options.get(USER_BASE);
-        String userSearchMatching = (String) options.get(USER_SEARCH_MATCHING);
-        String userSearchSubtree = (String) options.get(USER_SEARCH_SUBTREE);
-        roleBase = (String) options.get(ROLE_BASE);
-        roleName = (String) options.get(ROLE_NAME);
-        String roleSearchMatching = (String) options.get(ROLE_SEARCH_MATCHING);
-        String roleSearchSubtree = (String) options.get(ROLE_SEARCH_SUBTREE);
-        userRoleName = (String) options.get(USER_ROLE_NAME);
-        userSearchMatchingFormat = new MessageFormat(userSearchMatching);
-        roleSearchMatchingFormat = new MessageFormat(roleSearchMatching);
-        userSearchSubtreeBool = new Boolean(userSearchSubtree).booleanValue();
-        roleSearchSubtreeBool = new Boolean(roleSearchSubtree).booleanValue();
-    }
-
-    public boolean login() throws LoginException {
-        Callback[] callbacks = new Callback[2];
-
-        callbacks[0] = new NameCallback("User name");
-        callbacks[1] = new PasswordCallback("Password", false);
-        try {
-            handler.handle(callbacks);
-        } catch (IOException ioe) {
-            throw (LoginException) new LoginException().initCause(ioe);
-        } catch (UnsupportedCallbackException uce) {
-            throw (LoginException) new LoginException().initCause(uce);
-        }
-        username = ((NameCallback) callbacks[0]).getName();
-        String password = new String(((PasswordCallback) callbacks[1]).getPassword());
-
-        if (username == null || "".equals(username) || password == null || "".equals(password)) {
-            return false;
-        }
-
-        try {
-            boolean result = authenticate(username, password);
-            if(!result) {
-                throw new FailedLoginException();
-            } else {
-                return true;
-            }
-        } catch (Exception e) {
-            throw (LoginException) new LoginException("LDAP Error").initCause(e);
-        }
-    }
-
-    public boolean logout() throws LoginException {
-        username = null;
-        return true;
-    }
-
-    public boolean commit() throws LoginException {
-        Set principals = subject.getPrincipals();
-        principals.add(new UserPrincipal(username));
-        Iterator iter = groups.iterator();
-        while (iter.hasNext()) {
-            principals.add(iter.next());
-        }
-        return true;
-    }
-
-    public boolean abort() throws LoginException {
-        username = null;
-        return true;
-    }
-
-    protected void close(DirContext context) {
-        try {
-            context.close();
-        } catch (Exception e) {
-            log.error(e);
-        }
-    }
-
-    protected boolean authenticate(String username, String password) throws Exception {
-
-        DirContext context = null;
-        context = open();
-
-        try {
-
-            String filter = userSearchMatchingFormat.format(new String[]{username});
-            SearchControls constraints = new SearchControls();
-            if (userSearchSubtreeBool) {
-                constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
-            } else {
-                constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
-            }
-
-            //setup attributes
-            ArrayList list = new ArrayList();
-            if (userRoleName != null) {
-                list.add(userRoleName);
-            }
-            String[] attribs = new String[list.size()];
-            list.toArray(attribs);
-            constraints.setReturningAttributes(attribs);
-
-
-            NamingEnumeration results = context.search(userBase, filter, constraints);
-
-            if (results == null || !results.hasMore()) {
-                return false;
-            }
-
-            SearchResult result = (SearchResult) results.next();
-
-            if (results.hasMore()) {
-                //ignore for now
-            }
-            NameParser parser = context.getNameParser("");
-            Name contextName = parser.parse(context.getNameInNamespace());
-            Name baseName = parser.parse(userBase);
-            Name entryName = parser.parse(result.getName());
-            Name name = contextName.addAll(baseName);
-            name = name.addAll(entryName);
-            String dn = name.toString();
-
-            Attributes attrs = result.getAttributes();
-            if (attrs == null) {
-                return false;
-            }
-            ArrayList roles = null;
-            if (userRoleName != null) {
-                roles = addAttributeValues(userRoleName, attrs, roles);
-            }
-
-            //check the credentials by binding to server
-            if (bindUser(context, dn, password)) {
-                //if authenticated add more roles
-                roles = getRoles(context, dn, username, roles);
-                for (int i = 0; i < roles.size(); i++) {
-                    groups.add(new GroupPrincipal((String) roles.get(i)));
-                }
-            } else {
-                return false;
-            }
-        } catch (CommunicationException e) {
-
-        } catch (NamingException e) {
-            if (context != null) {
-                close(context);
-            }
-            return false;
-        }
-
-
-        return true;
-    }
-
-    protected ArrayList getRoles(DirContext context, String dn, String username, ArrayList currentRoles) throws NamingException {
-        ArrayList list = currentRoles;
-        if (list == null) {
-            list = new ArrayList();
-        }
-        if (roleName == null || "".equals(roleName)) {
-            return list;
-        }
-        String filter = roleSearchMatchingFormat.format(new String[]{doRFC2254Encoding(dn), username});
-
-        SearchControls constraints = new SearchControls();
-        if (roleSearchSubtreeBool) {
-            constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
-        } else {
-            constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
-        }
-        NamingEnumeration results =
-                context.search(roleBase, filter, constraints);
-        while (results.hasMore()) {
-            SearchResult result = (SearchResult) results.next();
-            Attributes attrs = result.getAttributes();
-            if (attrs == null) {
-                continue;
-            }
-            list = addAttributeValues(roleName, attrs, list);
-        }
-        return list;
-
-    }
-
-
-    protected String doRFC2254Encoding(String inputString) {
-        StringBuffer buf = new StringBuffer(inputString.length());
-        for (int i = 0; i < inputString.length(); i++) {
-            char c = inputString.charAt(i);
-            switch (c) {
-                case '\\':
-                    buf.append("\\5c");
-                    break;
-                case '*':
-                    buf.append("\\2a");
-                    break;
-                case '(':
-                    buf.append("\\28");
-                    break;
-                case ')':
-                    buf.append("\\29");
-                    break;
-                case '\0':
-                    buf.append("\\00");
-                    break;
-                default:
-                    buf.append(c);
-                    break;
-            }
-        }
-        return buf.toString();
-    }
-
-    protected boolean bindUser(DirContext context, String dn, String password) throws NamingException {
-        boolean isValid = false;
-
-        context.addToEnvironment(Context.SECURITY_PRINCIPAL, dn);
-        context.addToEnvironment(Context.SECURITY_CREDENTIALS, password);
-        try {
-            context.getAttributes("", null);
-            isValid = true;
-        } catch (AuthenticationException e) {
-            isValid = false;
-            log.debug("Authentication failed for dn=" + dn);
-        }
-
-        if (connectionUsername != null) {
-            context.addToEnvironment(Context.SECURITY_PRINCIPAL,
-                    connectionUsername);
-        } else {
-            context.removeFromEnvironment(Context.SECURITY_PRINCIPAL);
-        }
-
-        if (connectionPassword != null) {
-            context.addToEnvironment(Context.SECURITY_CREDENTIALS,
-                    connectionPassword);
-        } else {
-            context.removeFromEnvironment(Context.SECURITY_CREDENTIALS);
-        }
-
-        return isValid;
-    }
-
-    private ArrayList addAttributeValues(String attrId, Attributes attrs, ArrayList values)
-            throws NamingException
-    {
-
-        if (attrId == null || attrs == null) {
-            return values;
-        }
-        if (values == null) {
-            values = new ArrayList();
-        }
-        Attribute attr = attrs.get(attrId);
-        if (attr == null) {
-            return (values);
-        }
-        NamingEnumeration e = attr.getAll();
-        while (e.hasMore()) {
-            String value = (String) e.next();
-            values.add(value);
-        }
-        return values;
-    }
-
-    protected DirContext open() throws NamingException {
-        if (context != null) {
-            return context;
-        }
-
-        try {
-            Hashtable env = new Hashtable();
-            env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
-            if (connectionUsername != null || !"".equals(connectionUsername)) {
-                env.put(Context.SECURITY_PRINCIPAL, connectionUsername);
-            }
-            if (connectionPassword != null || !"".equals(connectionPassword)) {
-                env.put(Context.SECURITY_CREDENTIALS, connectionPassword);
-            }
-            env.put(Context.SECURITY_PROTOCOL, connectionProtocol);
-            env.put(Context.PROVIDER_URL, connectionURL);
-            env.put(Context.SECURITY_AUTHENTICATION, authentication);
-            context = new InitialDirContext(env);
-
-        } catch (NamingException e) {
-            log.error(e);
-            throw e;
-        }
-        return context;
-    }
-
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jaas;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import javax.naming.AuthenticationException;
+import javax.naming.CommunicationException;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.login.FailedLoginException;
+import javax.security.auth.spi.LoginModule;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * @version $Rev: $ $Date: $
+ */
+public class LDAPLoginModule implements LoginModule {
+
+    private static Log log = LogFactory.getLog(LDAPLoginModule.class);
+
+    private Subject subject;
+    private CallbackHandler handler;
+
+    private static final String INITIAL_CONTEXT_FACTORY = "initialContextFactory";
+    private static final String CONNECTION_URL = "connectionURL";
+    private static final String CONNECTION_USERNAME = "connectionUsername";
+    private static final String CONNECTION_PASSWORD = "connectionPassword";
+    private static final String CONNECTION_PROTOCOL = "connectionProtocol";
+    private static final String AUTHENTICATION = "authentication";
+    private static final String USER_BASE = "userBase";
+    private static final String USER_SEARCH_MATCHING = "userSearchMatching";
+    private static final String USER_SEARCH_SUBTREE = "userSearchSubtree";
+    private static final String ROLE_BASE = "roleBase";
+    private static final String ROLE_NAME = "roleName";
+    private static final String ROLE_SEARCH_MATCHING = "roleSearchMatching";
+    private static final String ROLE_SEARCH_SUBTREE = "roleSearchSubtree";
+    private static final String USER_ROLE_NAME = "userRoleName";
+
+    private String initialContextFactory;
+    private String connectionURL;
+    private String connectionUsername;
+    private String connectionPassword;
+    private String connectionProtocol;
+    private String authentication;
+    private String userBase;
+    private String roleBase;
+    private String roleName;
+    private String userRoleName;
+
+    private String username;
+
+    protected DirContext context = null;
+
+    private MessageFormat userSearchMatchingFormat;
+    private MessageFormat roleSearchMatchingFormat;
+
+    private boolean userSearchSubtreeBool = false;
+    private boolean roleSearchSubtreeBool = false;
+
+    Set groups = new HashSet();
+
+    public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
+        this.subject = subject;
+        this.handler = callbackHandler;
+        initialContextFactory = (String) options.get(INITIAL_CONTEXT_FACTORY);
+        connectionURL = (String) options.get(CONNECTION_URL);
+        connectionUsername = (String) options.get(CONNECTION_USERNAME);
+        connectionPassword = (String) options.get(CONNECTION_PASSWORD);
+        connectionProtocol = (String) options.get(CONNECTION_PROTOCOL);
+        authentication = (String) options.get(AUTHENTICATION);
+        userBase = (String) options.get(USER_BASE);
+        String userSearchMatching = (String) options.get(USER_SEARCH_MATCHING);
+        String userSearchSubtree = (String) options.get(USER_SEARCH_SUBTREE);
+        roleBase = (String) options.get(ROLE_BASE);
+        roleName = (String) options.get(ROLE_NAME);
+        String roleSearchMatching = (String) options.get(ROLE_SEARCH_MATCHING);
+        String roleSearchSubtree = (String) options.get(ROLE_SEARCH_SUBTREE);
+        userRoleName = (String) options.get(USER_ROLE_NAME);
+        userSearchMatchingFormat = new MessageFormat(userSearchMatching);
+        roleSearchMatchingFormat = new MessageFormat(roleSearchMatching);
+        userSearchSubtreeBool = new Boolean(userSearchSubtree).booleanValue();
+        roleSearchSubtreeBool = new Boolean(roleSearchSubtree).booleanValue();
+    }
+
+    public boolean login() throws LoginException {
+        Callback[] callbacks = new Callback[2];
+
+        callbacks[0] = new NameCallback("User name");
+        callbacks[1] = new PasswordCallback("Password", false);
+        try {
+            handler.handle(callbacks);
+        } catch (IOException ioe) {
+            throw (LoginException) new LoginException().initCause(ioe);
+        } catch (UnsupportedCallbackException uce) {
+            throw (LoginException) new LoginException().initCause(uce);
+        }
+        username = ((NameCallback) callbacks[0]).getName();
+        String password = new String(((PasswordCallback) callbacks[1]).getPassword());
+
+        if (username == null || "".equals(username) || password == null || "".equals(password)) {
+            return false;
+        }
+
+        try {
+            boolean result = authenticate(username, password);
+            if(!result) {
+                throw new FailedLoginException();
+            } else {
+                return true;
+            }
+        } catch (Exception e) {
+            throw (LoginException) new LoginException("LDAP Error").initCause(e);
+        }
+    }
+
+    public boolean logout() throws LoginException {
+        username = null;
+        return true;
+    }
+
+    public boolean commit() throws LoginException {
+        Set principals = subject.getPrincipals();
+        principals.add(new UserPrincipal(username));
+        Iterator iter = groups.iterator();
+        while (iter.hasNext()) {
+            principals.add(iter.next());
+        }
+        return true;
+    }
+
+    public boolean abort() throws LoginException {
+        username = null;
+        return true;
+    }
+
+    protected void close(DirContext context) {
+        try {
+            context.close();
+        } catch (Exception e) {
+            log.error(e);
+        }
+    }
+
+    protected boolean authenticate(String username, String password) throws Exception {
+
+        DirContext context = null;
+        context = open();
+
+        try {
+
+            String filter = userSearchMatchingFormat.format(new String[]{username});
+            SearchControls constraints = new SearchControls();
+            if (userSearchSubtreeBool) {
+                constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
+            } else {
+                constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+            }
+
+            //setup attributes
+            ArrayList list = new ArrayList();
+            if (userRoleName != null) {
+                list.add(userRoleName);
+            }
+            String[] attribs = new String[list.size()];
+            list.toArray(attribs);
+            constraints.setReturningAttributes(attribs);
+
+
+            NamingEnumeration results = context.search(userBase, filter, constraints);
+
+            if (results == null || !results.hasMore()) {
+                return false;
+            }
+
+            SearchResult result = (SearchResult) results.next();
+
+            if (results.hasMore()) {
+                //ignore for now
+            }
+            NameParser parser = context.getNameParser("");
+            Name contextName = parser.parse(context.getNameInNamespace());
+            Name baseName = parser.parse(userBase);
+            Name entryName = parser.parse(result.getName());
+            Name name = contextName.addAll(baseName);
+            name = name.addAll(entryName);
+            String dn = name.toString();
+
+            Attributes attrs = result.getAttributes();
+            if (attrs == null) {
+                return false;
+            }
+            ArrayList roles = null;
+            if (userRoleName != null) {
+                roles = addAttributeValues(userRoleName, attrs, roles);
+            }
+
+            //check the credentials by binding to server
+            if (bindUser(context, dn, password)) {
+                //if authenticated add more roles
+                roles = getRoles(context, dn, username, roles);
+                for (int i = 0; i < roles.size(); i++) {
+                    groups.add(new GroupPrincipal((String) roles.get(i)));
+                }
+            } else {
+                return false;
+            }
+        } catch (CommunicationException e) {
+
+        } catch (NamingException e) {
+            if (context != null) {
+                close(context);
+            }
+            return false;
+        }
+
+
+        return true;
+    }
+
+    protected ArrayList getRoles(DirContext context, String dn, String username, ArrayList currentRoles) throws NamingException {
+        ArrayList list = currentRoles;
+        if (list == null) {
+            list = new ArrayList();
+        }
+        if (roleName == null || "".equals(roleName)) {
+            return list;
+        }
+        String filter = roleSearchMatchingFormat.format(new String[]{doRFC2254Encoding(dn), username});
+
+        SearchControls constraints = new SearchControls();
+        if (roleSearchSubtreeBool) {
+            constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
+        } else {
+            constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+        }
+        NamingEnumeration results =
+                context.search(roleBase, filter, constraints);
+        while (results.hasMore()) {
+            SearchResult result = (SearchResult) results.next();
+            Attributes attrs = result.getAttributes();
+            if (attrs == null) {
+                continue;
+            }
+            list = addAttributeValues(roleName, attrs, list);
+        }
+        return list;
+
+    }
+
+
+    protected String doRFC2254Encoding(String inputString) {
+        StringBuffer buf = new StringBuffer(inputString.length());
+        for (int i = 0; i < inputString.length(); i++) {
+            char c = inputString.charAt(i);
+            switch (c) {
+                case '\\':
+                    buf.append("\\5c");
+                    break;
+                case '*':
+                    buf.append("\\2a");
+                    break;
+                case '(':
+                    buf.append("\\28");
+                    break;
+                case ')':
+                    buf.append("\\29");
+                    break;
+                case '\0':
+                    buf.append("\\00");
+                    break;
+                default:
+                    buf.append(c);
+                    break;
+            }
+        }
+        return buf.toString();
+    }
+
+    protected boolean bindUser(DirContext context, String dn, String password) throws NamingException {
+        boolean isValid = false;
+
+        context.addToEnvironment(Context.SECURITY_PRINCIPAL, dn);
+        context.addToEnvironment(Context.SECURITY_CREDENTIALS, password);
+        try {
+            context.getAttributes("", null);
+            isValid = true;
+        } catch (AuthenticationException e) {
+            isValid = false;
+            log.debug("Authentication failed for dn=" + dn);
+        }
+
+        if (connectionUsername != null) {
+            context.addToEnvironment(Context.SECURITY_PRINCIPAL,
+                    connectionUsername);
+        } else {
+            context.removeFromEnvironment(Context.SECURITY_PRINCIPAL);
+        }
+
+        if (connectionPassword != null) {
+            context.addToEnvironment(Context.SECURITY_CREDENTIALS,
+                    connectionPassword);
+        } else {
+            context.removeFromEnvironment(Context.SECURITY_CREDENTIALS);
+        }
+
+        return isValid;
+    }
+
+    private ArrayList addAttributeValues(String attrId, Attributes attrs, ArrayList values)
+            throws NamingException
+    {
+
+        if (attrId == null || attrs == null) {
+            return values;
+        }
+        if (values == null) {
+            values = new ArrayList();
+        }
+        Attribute attr = attrs.get(attrId);
+        if (attr == null) {
+            return (values);
+        }
+        NamingEnumeration e = attr.getAll();
+        while (e.hasMore()) {
+            String value = (String) e.next();
+            values.add(value);
+        }
+        return values;
+    }
+
+    protected DirContext open() throws NamingException {
+        if (context != null) {
+            return context;
+        }
+
+        try {
+            Hashtable env = new Hashtable();
+            env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
+            if (connectionUsername != null || !"".equals(connectionUsername)) {
+                env.put(Context.SECURITY_PRINCIPAL, connectionUsername);
+            }
+            if (connectionPassword != null || !"".equals(connectionPassword)) {
+                env.put(Context.SECURITY_CREDENTIALS, connectionPassword);
+            }
+            env.put(Context.SECURITY_PROTOCOL, connectionProtocol);
+            env.put(Context.PROVIDER_URL, connectionURL);
+            env.put(Context.SECURITY_AUTHENTICATION, authentication);
+            context = new InitialDirContext(env);
+
+        } catch (NamingException e) {
+            log.error(e);
+            throw e;
+        }
+        return context;
+    }
+
+}

Propchange: incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/LDAPLoginModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/PropertiesLoginModule.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/PropertiesLoginModule.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/PropertiesLoginModule.java (original)
+++ incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/PropertiesLoginModule.java Tue Feb 21 15:12:56 2006
@@ -1,172 +1,172 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.jaas;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.login.FailedLoginException;
-import javax.security.auth.spi.LoginModule;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-
-/**
- * @version $Rev: $ $Date: $
- */
-public class PropertiesLoginModule implements LoginModule {
-
-    private final String USER_FILE = "org.apache.activemq.jaas.properties.user";
-    private final String GROUP_FILE = "org.apache.activemq.jaas.properties.group";
-
-    private static final Log log = LogFactory.getLog(PropertiesLoginModule.class);
-
-    private Subject subject;
-    private CallbackHandler callbackHandler;
-
-    private boolean debug;
-    private String usersFile;
-    private String groupsFile;
-    private Properties users = new Properties();
-    private Properties groups = new Properties();
-    private String user;
-    private Set principals = new HashSet();
-    private File baseDir;
-
-    public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
-        this.subject = subject;
-        this.callbackHandler = callbackHandler;
-
-        if( System.getProperty("java.security.auth.login.config")!=null ) {
-            baseDir=new File(System.getProperty("java.security.auth.login.config")).getParentFile();
-        } else {
-            baseDir = new File(".");
-        }
-        System.out.println("setting based dir="+baseDir);
-
-        debug = "true".equalsIgnoreCase((String) options.get("debug"));
-        usersFile = (String) options.get(USER_FILE)+"";
-        groupsFile = (String) options.get(GROUP_FILE)+"";
-
-        if (debug) {
-            log.debug("Initialized debug=" + debug + " usersFile=" + usersFile + " groupsFile=" + groupsFile+" basedir="+baseDir);
-        }
-    }
-
-    public boolean login() throws LoginException {
-        File f = new File(baseDir,usersFile);
-        try {
-            users.load(new java.io.FileInputStream(f));
-        } catch (IOException ioe) {
-            throw new LoginException("Unable to load user properties file " + f);
-        }
-        f = new File(baseDir, groupsFile);
-        try {
-            groups.load(new java.io.FileInputStream(f));
-        } catch (IOException ioe) {
-            throw new LoginException("Unable to load group properties file " + f);
-        }
-
-        Callback[] callbacks = new Callback[2];
-
-        callbacks[0] = new NameCallback("Username: ");
-        callbacks[1] = new PasswordCallback("Password: ", false);
-        try {
-            callbackHandler.handle(callbacks);
-        } catch (IOException ioe) {
-            throw new LoginException(ioe.getMessage());
-        } catch (UnsupportedCallbackException uce) {
-            throw new LoginException(uce.getMessage() + " not available to obtain information from user");
-        }
-        user = ((NameCallback) callbacks[0]).getName();
-        char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword();
-        if (tmpPassword == null) tmpPassword = new char[0];
-
-        String password = users.getProperty(user);
-
-        if (password == null) throw new FailedLoginException("User does exist");
-        if (!password.equals(new String(tmpPassword))) throw new FailedLoginException("Password does not match");
-
-        users.clear();
-
-        if (debug) {
-            log.debug("login " + user);
-        }
-        return true;
-    }
-
-    public boolean commit() throws LoginException {
-        principals.add(new UserPrincipal(user));
-
-        for (Enumeration enumeration = groups.keys(); enumeration.hasMoreElements();) {
-            String name = (String) enumeration.nextElement();
-            String[] userList = ((String) groups.getProperty(name) + "").split(",");
-            for (int i = 0; i < userList.length; i++) {
-                if (user.equals(userList[i])) {
-                    principals.add(new GroupPrincipal(name));
-                    break;
-                }
-            }
-        }
-
-        subject.getPrincipals().addAll(principals);
-
-        clear();
-
-        if (debug) {
-            log.debug("commit");
-        }
-        return true;
-    }
-
-    public boolean abort() throws LoginException {
-        clear();
-
-        if (debug) {
-            log.debug("abort");
-        }
-        return true;
-    }
-
-    public boolean logout() throws LoginException {
-        subject.getPrincipals().removeAll(principals);
-        principals.clear();
-
-        if (debug) {
-            log.debug("logout");
-        }
-        return true;
-    }
-
-    private void clear() {
-        groups.clear();
-        user = null;
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jaas;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.login.FailedLoginException;
+import javax.security.auth.spi.LoginModule;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * @version $Rev: $ $Date: $
+ */
+public class PropertiesLoginModule implements LoginModule {
+
+    private final String USER_FILE = "org.apache.activemq.jaas.properties.user";
+    private final String GROUP_FILE = "org.apache.activemq.jaas.properties.group";
+
+    private static final Log log = LogFactory.getLog(PropertiesLoginModule.class);
+
+    private Subject subject;
+    private CallbackHandler callbackHandler;
+
+    private boolean debug;
+    private String usersFile;
+    private String groupsFile;
+    private Properties users = new Properties();
+    private Properties groups = new Properties();
+    private String user;
+    private Set principals = new HashSet();
+    private File baseDir;
+
+    public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
+        this.subject = subject;
+        this.callbackHandler = callbackHandler;
+
+        if( System.getProperty("java.security.auth.login.config")!=null ) {
+            baseDir=new File(System.getProperty("java.security.auth.login.config")).getParentFile();
+        } else {
+            baseDir = new File(".");
+        }
+        System.out.println("setting based dir="+baseDir);
+
+        debug = "true".equalsIgnoreCase((String) options.get("debug"));
+        usersFile = (String) options.get(USER_FILE)+"";
+        groupsFile = (String) options.get(GROUP_FILE)+"";
+
+        if (debug) {
+            log.debug("Initialized debug=" + debug + " usersFile=" + usersFile + " groupsFile=" + groupsFile+" basedir="+baseDir);
+        }
+    }
+
+    public boolean login() throws LoginException {
+        File f = new File(baseDir,usersFile);
+        try {
+            users.load(new java.io.FileInputStream(f));
+        } catch (IOException ioe) {
+            throw new LoginException("Unable to load user properties file " + f);
+        }
+        f = new File(baseDir, groupsFile);
+        try {
+            groups.load(new java.io.FileInputStream(f));
+        } catch (IOException ioe) {
+            throw new LoginException("Unable to load group properties file " + f);
+        }
+
+        Callback[] callbacks = new Callback[2];
+
+        callbacks[0] = new NameCallback("Username: ");
+        callbacks[1] = new PasswordCallback("Password: ", false);
+        try {
+            callbackHandler.handle(callbacks);
+        } catch (IOException ioe) {
+            throw new LoginException(ioe.getMessage());
+        } catch (UnsupportedCallbackException uce) {
+            throw new LoginException(uce.getMessage() + " not available to obtain information from user");
+        }
+        user = ((NameCallback) callbacks[0]).getName();
+        char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword();
+        if (tmpPassword == null) tmpPassword = new char[0];
+
+        String password = users.getProperty(user);
+
+        if (password == null) throw new FailedLoginException("User does exist");
+        if (!password.equals(new String(tmpPassword))) throw new FailedLoginException("Password does not match");
+
+        users.clear();
+
+        if (debug) {
+            log.debug("login " + user);
+        }
+        return true;
+    }
+
+    public boolean commit() throws LoginException {
+        principals.add(new UserPrincipal(user));
+
+        for (Enumeration enumeration = groups.keys(); enumeration.hasMoreElements();) {
+            String name = (String) enumeration.nextElement();
+            String[] userList = ((String) groups.getProperty(name) + "").split(",");
+            for (int i = 0; i < userList.length; i++) {
+                if (user.equals(userList[i])) {
+                    principals.add(new GroupPrincipal(name));
+                    break;
+                }
+            }
+        }
+
+        subject.getPrincipals().addAll(principals);
+
+        clear();
+
+        if (debug) {
+            log.debug("commit");
+        }
+        return true;
+    }
+
+    public boolean abort() throws LoginException {
+        clear();
+
+        if (debug) {
+            log.debug("abort");
+        }
+        return true;
+    }
+
+    public boolean logout() throws LoginException {
+        subject.getPrincipals().removeAll(principals);
+        principals.clear();
+
+        if (debug) {
+            log.debug("logout");
+        }
+        return true;
+    }
+
+    private void clear() {
+        groups.clear();
+        user = null;
+    }
+}

Propchange: incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/PropertiesLoginModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/UserPrincipal.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/UserPrincipal.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/UserPrincipal.java (original)
+++ incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/UserPrincipal.java Tue Feb 21 15:12:56 2006
@@ -1,60 +1,60 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.jaas;
-
-import java.security.Principal;
-
-
-/**
- * @version $Rev: $ $Date: $
- */
-public class UserPrincipal implements Principal {
-
-    private final String name;
-    private transient int hash;
-
-    public UserPrincipal(String name) {
-        if (name == null) throw new IllegalArgumentException("name cannot be null");
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        final UserPrincipal that = (UserPrincipal) o;
-
-        if (!name.equals(that.name)) return false;
-
-        return true;
-    }
-
-    public int hashCode() {
-        if (hash == 0) {
-            hash = name.hashCode();
-        }
-        return hash;
-    }
-
-    public String toString() {
-        return name;
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jaas;
+
+import java.security.Principal;
+
+
+/**
+ * @version $Rev: $ $Date: $
+ */
+public class UserPrincipal implements Principal {
+
+    private final String name;
+    private transient int hash;
+
+    public UserPrincipal(String name) {
+        if (name == null) throw new IllegalArgumentException("name cannot be null");
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final UserPrincipal that = (UserPrincipal) o;
+
+        if (!name.equals(that.name)) return false;
+
+        return true;
+    }
+
+    public int hashCode() {
+        if (hash == 0) {
+            hash = name.hashCode();
+        }
+        return hash;
+    }
+
+    public String toString() {
+        return name;
+    }
+}

Propchange: incubator/activemq/trunk/activemq-jaas/src/main/java/org/apache/activemq/jaas/UserPrincipal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/GroupPrincipalTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/GroupPrincipalTest.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/GroupPrincipalTest.java (original)
+++ incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/GroupPrincipalTest.java Tue Feb 21 15:12:56 2006
@@ -1,61 +1,61 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.jaas;
-
-import org.apache.activemq.jaas.GroupPrincipal;
-
-import junit.framework.TestCase;
-
-
-/**
- * @version $Rev: $ $Date: $
- */
-public class GroupPrincipalTest extends TestCase {
-
-    public void testArguments() {
-        GroupPrincipal principal = new GroupPrincipal("FOO");
-
-       assertEquals("FOO", principal.getName());
-
-        try {
-            new GroupPrincipal(null);
-            fail("Should have thrown IllegalArgumentException");
-        } catch (IllegalArgumentException ingore) {
-
-        }
-    }
-
-    public void testHash() {
-        GroupPrincipal p1 = new GroupPrincipal("FOO");
-        GroupPrincipal p2 = new GroupPrincipal("FOO");
-
-        assertEquals(p1.hashCode(), p1.hashCode());
-        assertEquals(p1.hashCode(), p2.hashCode());
-    }
-
-    public void testEquals() {
-        GroupPrincipal p1 = new GroupPrincipal("FOO");
-        GroupPrincipal p2 = new GroupPrincipal("FOO");
-        GroupPrincipal p3 = new GroupPrincipal("BAR");
-
-        assertTrue(p1.equals(p1));
-        assertTrue(p1.equals(p2));
-        assertFalse(p1.equals(null));
-        assertFalse(p1.equals("FOO"));
-        assertFalse(p1.equals(p3));
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jaas;
+
+import org.apache.activemq.jaas.GroupPrincipal;
+
+import junit.framework.TestCase;
+
+
+/**
+ * @version $Rev: $ $Date: $
+ */
+public class GroupPrincipalTest extends TestCase {
+
+    public void testArguments() {
+        GroupPrincipal principal = new GroupPrincipal("FOO");
+
+       assertEquals("FOO", principal.getName());
+
+        try {
+            new GroupPrincipal(null);
+            fail("Should have thrown IllegalArgumentException");
+        } catch (IllegalArgumentException ingore) {
+
+        }
+    }
+
+    public void testHash() {
+        GroupPrincipal p1 = new GroupPrincipal("FOO");
+        GroupPrincipal p2 = new GroupPrincipal("FOO");
+
+        assertEquals(p1.hashCode(), p1.hashCode());
+        assertEquals(p1.hashCode(), p2.hashCode());
+    }
+
+    public void testEquals() {
+        GroupPrincipal p1 = new GroupPrincipal("FOO");
+        GroupPrincipal p2 = new GroupPrincipal("FOO");
+        GroupPrincipal p3 = new GroupPrincipal("BAR");
+
+        assertTrue(p1.equals(p1));
+        assertTrue(p1.equals(p2));
+        assertFalse(p1.equals(null));
+        assertFalse(p1.equals("FOO"));
+        assertFalse(p1.equals(p3));
+    }
+}

Propchange: incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/GroupPrincipalTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/LDAPLoginModuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/LDAPLoginModuleTest.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/LDAPLoginModuleTest.java (original)
+++ incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/LDAPLoginModuleTest.java Tue Feb 21 15:12:56 2006
@@ -1,139 +1,139 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.jaas;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Properties;
-import javax.naming.Context;
-import javax.naming.NameClassPair;
-import javax.naming.NamingEnumeration;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
-
-import junit.framework.TestCase;
-
-import org.apache.activemq.jaas.ldap.MutableServerStartupConfiguration;
-import org.apache.activemq.jaas.ldap.ServerContextFactory;
-import org.apache.ldap.server.configuration.ShutdownConfiguration;
-import org.apache.ldap.server.jndi.CoreContextFactory;
-
-
-
-/**
- * @version $Rev: $ $Date: $
- */
-public class LDAPLoginModuleTest extends TestCase {
-
-    private static final String PRINCIPAL = "uid=admin,ou=system";
-    private static final String CREDENTIALS = "secret";
-
-    public void testNothing() {
-    }
-
-    public void testRunning() throws Exception {
-
-        Hashtable env = new Hashtable();
-        env.put(Context.PROVIDER_URL, "ldap://localhost:9389");
-        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
-        env.put(Context.SECURITY_AUTHENTICATION, "simple");
-        env.put(Context.SECURITY_PRINCIPAL, PRINCIPAL);
-        env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS);
-        DirContext ctx = new InitialDirContext(env);
-
-        // Perform search using URL
-        // NamingEnumeration answer = ctx.search(
-        // "ldap://localhost:389/ou=system", "(uid=admin)", null);
-        HashSet set = new HashSet();
-
-        NamingEnumeration list = ctx.list("ou=system");
-
-        while (list.hasMore()) {
-            NameClassPair ncp = (NameClassPair) list.next();
-            set.add(ncp.getName());
-        }
-
-        assertTrue(set.contains("uid=admin"));
-        assertTrue(set.contains("ou=users"));
-        assertTrue(set.contains("ou=groups"));
-        assertTrue(set.contains("ou=configuration"));
-        assertTrue(set.contains("prefNodeName=sysPrefRoot"));
-
-    }
-
-    public void XtestLogin() throws LoginException {
-        LoginContext context = new LoginContext("LDAPLogin", new CallbackHandler() {
-            public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
-                for (int i = 0; i < callbacks.length; i++) {
-                    if (callbacks[i] instanceof NameCallback) {
-                        ((NameCallback) callbacks[i]).setName("first");
-                    } else if (callbacks[i] instanceof PasswordCallback) {
-                        ((PasswordCallback) callbacks[i]).setPassword("secret".toCharArray());
-                    } else {
-                        throw new UnsupportedCallbackException(callbacks[i]);
-                    }
-                }
-            }
-        });
-        context.login();
-        context.logout();
-    }
-
-    public void setUp() throws Exception {
-        MutableServerStartupConfiguration startup = new MutableServerStartupConfiguration();
-        // put some mandatory JNDI properties here
-        startup.setWorkingDirectory(new File("target/ldap"));
-        startup.setAllowAnonymousAccess(true);
-        startup.setLdapPort(9389);
-        startup.setEnableNetworking(true);
-        startup.setHost(InetAddress.getByName("localhost"));
-
-        Properties env = new Properties();
-        env.putAll(startup.toJndiEnvironment());
-        env.put(Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName());
-        env.put(Context.PROVIDER_URL, "ou=system");
-        env.put(Context.SECURITY_AUTHENTICATION, "simple");
-        env.put(Context.SECURITY_PRINCIPAL, PRINCIPAL);
-        env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS);
-
-        //Fire it up
-        new InitialDirContext(env);
-    }
-
-    public void tearDown() throws Exception {
-        Properties env = new Properties();
-        env.putAll(new ShutdownConfiguration().toJndiEnvironment());
-        env.put(Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName());
-        env.put(Context.PROVIDER_URL, "ou=system");
-        env.put(Context.SECURITY_AUTHENTICATION, "simple");
-        env.put(Context.SECURITY_PRINCIPAL, PRINCIPAL);
-        env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS);
-
-        //Shut it down
-        new InitialDirContext(env);
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jaas;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Properties;
+import javax.naming.Context;
+import javax.naming.NameClassPair;
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
+
+import junit.framework.TestCase;
+
+import org.apache.activemq.jaas.ldap.MutableServerStartupConfiguration;
+import org.apache.activemq.jaas.ldap.ServerContextFactory;
+import org.apache.ldap.server.configuration.ShutdownConfiguration;
+import org.apache.ldap.server.jndi.CoreContextFactory;
+
+
+
+/**
+ * @version $Rev: $ $Date: $
+ */
+public class LDAPLoginModuleTest extends TestCase {
+
+    private static final String PRINCIPAL = "uid=admin,ou=system";
+    private static final String CREDENTIALS = "secret";
+
+    public void testNothing() {
+    }
+
+    public void testRunning() throws Exception {
+
+        Hashtable env = new Hashtable();
+        env.put(Context.PROVIDER_URL, "ldap://localhost:9389");
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+        env.put(Context.SECURITY_AUTHENTICATION, "simple");
+        env.put(Context.SECURITY_PRINCIPAL, PRINCIPAL);
+        env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS);
+        DirContext ctx = new InitialDirContext(env);
+
+        // Perform search using URL
+        // NamingEnumeration answer = ctx.search(
+        // "ldap://localhost:389/ou=system", "(uid=admin)", null);
+        HashSet set = new HashSet();
+
+        NamingEnumeration list = ctx.list("ou=system");
+
+        while (list.hasMore()) {
+            NameClassPair ncp = (NameClassPair) list.next();
+            set.add(ncp.getName());
+        }
+
+        assertTrue(set.contains("uid=admin"));
+        assertTrue(set.contains("ou=users"));
+        assertTrue(set.contains("ou=groups"));
+        assertTrue(set.contains("ou=configuration"));
+        assertTrue(set.contains("prefNodeName=sysPrefRoot"));
+
+    }
+
+    public void XtestLogin() throws LoginException {
+        LoginContext context = new LoginContext("LDAPLogin", new CallbackHandler() {
+            public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+                for (int i = 0; i < callbacks.length; i++) {
+                    if (callbacks[i] instanceof NameCallback) {
+                        ((NameCallback) callbacks[i]).setName("first");
+                    } else if (callbacks[i] instanceof PasswordCallback) {
+                        ((PasswordCallback) callbacks[i]).setPassword("secret".toCharArray());
+                    } else {
+                        throw new UnsupportedCallbackException(callbacks[i]);
+                    }
+                }
+            }
+        });
+        context.login();
+        context.logout();
+    }
+
+    public void setUp() throws Exception {
+        MutableServerStartupConfiguration startup = new MutableServerStartupConfiguration();
+        // put some mandatory JNDI properties here
+        startup.setWorkingDirectory(new File("target/ldap"));
+        startup.setAllowAnonymousAccess(true);
+        startup.setLdapPort(9389);
+        startup.setEnableNetworking(true);
+        startup.setHost(InetAddress.getByName("localhost"));
+
+        Properties env = new Properties();
+        env.putAll(startup.toJndiEnvironment());
+        env.put(Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName());
+        env.put(Context.PROVIDER_URL, "ou=system");
+        env.put(Context.SECURITY_AUTHENTICATION, "simple");
+        env.put(Context.SECURITY_PRINCIPAL, PRINCIPAL);
+        env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS);
+
+        //Fire it up
+        new InitialDirContext(env);
+    }
+
+    public void tearDown() throws Exception {
+        Properties env = new Properties();
+        env.putAll(new ShutdownConfiguration().toJndiEnvironment());
+        env.put(Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName());
+        env.put(Context.PROVIDER_URL, "ou=system");
+        env.put(Context.SECURITY_AUTHENTICATION, "simple");
+        env.put(Context.SECURITY_PRINCIPAL, PRINCIPAL);
+        env.put(Context.SECURITY_CREDENTIALS, CREDENTIALS);
+
+        //Shut it down
+        new InitialDirContext(env);
+    }
+}

Propchange: incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/LDAPLoginModuleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/PropertiesLoginModuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/PropertiesLoginModuleTest.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/PropertiesLoginModuleTest.java (original)
+++ incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/PropertiesLoginModuleTest.java Tue Feb 21 15:12:56 2006
@@ -1,111 +1,111 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.jaas;
-
-import java.io.IOException;
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.FailedLoginException;
-import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
-
-import org.apache.activemq.jaas.GroupPrincipal;
-import org.apache.activemq.jaas.UserPrincipal;
-
-import junit.framework.TestCase;
-
-
-/**
- * @version $Rev: $ $Date: $
- */
-public class PropertiesLoginModuleTest extends TestCase {
-
-    public void testLogin() throws LoginException {
-        LoginContext context = new LoginContext("PropertiesLogin", new CallbackHandler() {
-            public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
-                for (int i = 0; i < callbacks.length; i++) {
-                    if (callbacks[i] instanceof NameCallback) {
-                        ((NameCallback) callbacks[i]).setName("first");
-                    } else if (callbacks[i] instanceof PasswordCallback) {
-                        ((PasswordCallback) callbacks[i]).setPassword("secret".toCharArray());
-                    } else {
-                        throw new UnsupportedCallbackException(callbacks[i]);
-                    }
-                }
-            }
-        });
-        context.login();
-
-        Subject subject = context.getSubject();
-
-        assertEquals("Should have three principals", 3, subject.getPrincipals().size());
-        assertEquals("Should have one user principal", 1, subject.getPrincipals(UserPrincipal.class).size());
-        assertEquals("Should have two group principals", 2, subject.getPrincipals(GroupPrincipal.class).size());
-
-        context.logout();
-
-        assertEquals("Should have zero principals", 0, subject.getPrincipals().size());
-    }
-
-    public void testBadUseridLogin() throws Exception {
-        LoginContext context = new LoginContext("PropertiesLogin", new CallbackHandler() {
-            public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
-                for (int i = 0; i < callbacks.length; i++) {
-                    if (callbacks[i] instanceof NameCallback) {
-                        ((NameCallback) callbacks[i]).setName("BAD");
-                    } else if (callbacks[i] instanceof PasswordCallback) {
-                        ((PasswordCallback) callbacks[i]).setPassword("secret".toCharArray());
-                    } else {
-                        throw new UnsupportedCallbackException(callbacks[i]);
-                    }
-                }
-            }
-        });
-        try {
-            context.login();
-            fail("Should have thrown a FailedLoginException");
-        } catch (FailedLoginException doNothing) {
-        }
-
-    }
-
-    public void testBadPWLogin() throws Exception {
-        LoginContext context = new LoginContext("PropertiesLogin", new CallbackHandler() {
-            public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
-                for (int i = 0; i < callbacks.length; i++) {
-                    if (callbacks[i] instanceof NameCallback) {
-                        ((NameCallback) callbacks[i]).setName("first");
-                    } else if (callbacks[i] instanceof PasswordCallback) {
-                        ((PasswordCallback) callbacks[i]).setPassword("BAD".toCharArray());
-                    } else {
-                        throw new UnsupportedCallbackException(callbacks[i]);
-                    }
-                }
-            }
-        });
-        try {
-            context.login();
-            fail("Should have thrown a FailedLoginException");
-        } catch (FailedLoginException doNothing) {
-        }
-
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jaas;
+
+import java.io.IOException;
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.FailedLoginException;
+import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
+
+import org.apache.activemq.jaas.GroupPrincipal;
+import org.apache.activemq.jaas.UserPrincipal;
+
+import junit.framework.TestCase;
+
+
+/**
+ * @version $Rev: $ $Date: $
+ */
+public class PropertiesLoginModuleTest extends TestCase {
+
+    public void testLogin() throws LoginException {
+        LoginContext context = new LoginContext("PropertiesLogin", new CallbackHandler() {
+            public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+                for (int i = 0; i < callbacks.length; i++) {
+                    if (callbacks[i] instanceof NameCallback) {
+                        ((NameCallback) callbacks[i]).setName("first");
+                    } else if (callbacks[i] instanceof PasswordCallback) {
+                        ((PasswordCallback) callbacks[i]).setPassword("secret".toCharArray());
+                    } else {
+                        throw new UnsupportedCallbackException(callbacks[i]);
+                    }
+                }
+            }
+        });
+        context.login();
+
+        Subject subject = context.getSubject();
+
+        assertEquals("Should have three principals", 3, subject.getPrincipals().size());
+        assertEquals("Should have one user principal", 1, subject.getPrincipals(UserPrincipal.class).size());
+        assertEquals("Should have two group principals", 2, subject.getPrincipals(GroupPrincipal.class).size());
+
+        context.logout();
+
+        assertEquals("Should have zero principals", 0, subject.getPrincipals().size());
+    }
+
+    public void testBadUseridLogin() throws Exception {
+        LoginContext context = new LoginContext("PropertiesLogin", new CallbackHandler() {
+            public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+                for (int i = 0; i < callbacks.length; i++) {
+                    if (callbacks[i] instanceof NameCallback) {
+                        ((NameCallback) callbacks[i]).setName("BAD");
+                    } else if (callbacks[i] instanceof PasswordCallback) {
+                        ((PasswordCallback) callbacks[i]).setPassword("secret".toCharArray());
+                    } else {
+                        throw new UnsupportedCallbackException(callbacks[i]);
+                    }
+                }
+            }
+        });
+        try {
+            context.login();
+            fail("Should have thrown a FailedLoginException");
+        } catch (FailedLoginException doNothing) {
+        }
+
+    }
+
+    public void testBadPWLogin() throws Exception {
+        LoginContext context = new LoginContext("PropertiesLogin", new CallbackHandler() {
+            public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+                for (int i = 0; i < callbacks.length; i++) {
+                    if (callbacks[i] instanceof NameCallback) {
+                        ((NameCallback) callbacks[i]).setName("first");
+                    } else if (callbacks[i] instanceof PasswordCallback) {
+                        ((PasswordCallback) callbacks[i]).setPassword("BAD".toCharArray());
+                    } else {
+                        throw new UnsupportedCallbackException(callbacks[i]);
+                    }
+                }
+            }
+        });
+        try {
+            context.login();
+            fail("Should have thrown a FailedLoginException");
+        } catch (FailedLoginException doNothing) {
+        }
+
+    }
+}

Propchange: incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/PropertiesLoginModuleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/UserPrincipalTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/UserPrincipalTest.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/UserPrincipalTest.java (original)
+++ incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/UserPrincipalTest.java Tue Feb 21 15:12:56 2006
@@ -1,61 +1,61 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.jaas;
-
-import org.apache.activemq.jaas.UserPrincipal;
-
-import junit.framework.TestCase;
-
-
-/**
- * @version $Rev: $ $Date: $
- */
-public class UserPrincipalTest extends TestCase {
-
-    public void testArguments() {
-        UserPrincipal principal = new UserPrincipal("FOO");
-
-       assertEquals("FOO", principal.getName());
-
-        try {
-            new UserPrincipal(null);
-            fail("Should have thrown IllegalArgumentException");
-        } catch (IllegalArgumentException ingore) {
-
-        }
-    }
-
-    public void testHash() {
-        UserPrincipal p1 = new UserPrincipal("FOO");
-        UserPrincipal p2 = new UserPrincipal("FOO");
-
-        assertEquals(p1.hashCode(), p1.hashCode());
-        assertEquals(p1.hashCode(), p2.hashCode());
-    }
-
-    public void testEquals() {
-        UserPrincipal p1 = new UserPrincipal("FOO");
-        UserPrincipal p2 = new UserPrincipal("FOO");
-        UserPrincipal p3 = new UserPrincipal("BAR");
-
-        assertTrue(p1.equals(p1));
-        assertTrue(p1.equals(p2));
-        assertFalse(p1.equals(null));
-        assertFalse(p1.equals("FOO"));
-        assertFalse(p1.equals(p3));
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jaas;
+
+import org.apache.activemq.jaas.UserPrincipal;
+
+import junit.framework.TestCase;
+
+
+/**
+ * @version $Rev: $ $Date: $
+ */
+public class UserPrincipalTest extends TestCase {
+
+    public void testArguments() {
+        UserPrincipal principal = new UserPrincipal("FOO");
+
+       assertEquals("FOO", principal.getName());
+
+        try {
+            new UserPrincipal(null);
+            fail("Should have thrown IllegalArgumentException");
+        } catch (IllegalArgumentException ingore) {
+
+        }
+    }
+
+    public void testHash() {
+        UserPrincipal p1 = new UserPrincipal("FOO");
+        UserPrincipal p2 = new UserPrincipal("FOO");
+
+        assertEquals(p1.hashCode(), p1.hashCode());
+        assertEquals(p1.hashCode(), p2.hashCode());
+    }
+
+    public void testEquals() {
+        UserPrincipal p1 = new UserPrincipal("FOO");
+        UserPrincipal p2 = new UserPrincipal("FOO");
+        UserPrincipal p3 = new UserPrincipal("BAR");
+
+        assertTrue(p1.equals(p1));
+        assertTrue(p1.equals(p2));
+        assertFalse(p1.equals(null));
+        assertFalse(p1.equals("FOO"));
+        assertFalse(p1.equals(p3));
+    }
+}

Propchange: incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/UserPrincipalTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/ldap/MutableServerStartupConfiguration.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/ldap/MutableServerStartupConfiguration.java?rev=379619&r1=379618&r2=379619&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/ldap/MutableServerStartupConfiguration.java (original)
+++ incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/ldap/MutableServerStartupConfiguration.java Tue Feb 21 15:12:56 2006
@@ -1,87 +1,87 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.jaas.ldap;
-
-import java.io.File;
-import java.net.InetAddress;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.mina.registry.ServiceRegistry;
-
-/**
- * A mutable version of {@link ServerStartupConfiguration}.
- *
- * @version $Rev: 233391 $ $Date: 2005-08-18 16:38:47 -0600 (Thu, 18 Aug 2005) $
- */
-public class MutableServerStartupConfiguration extends
-        ServerStartupConfiguration
-{
-    private static final long serialVersionUID = 515104910980600099L;
-
-    public MutableServerStartupConfiguration() {
-        super();
-    }
-
-    public void setAllowAnonymousAccess(boolean arg0) {
-        super.setAllowAnonymousAccess(arg0);
-    }
-
-    public void setAuthenticatorConfigurations(Set arg0) {
-        super.setAuthenticatorConfigurations(arg0);
-    }
-
-    public void setBootstrapSchemas(Set arg0) {
-        super.setBootstrapSchemas(arg0);
-    }
-
-    public void setContextPartitionConfigurations(Set arg0) {
-        super.setContextPartitionConfigurations(arg0);
-    }
-
-    public void setInterceptorConfigurations(List arg0) {
-        super.setInterceptorConfigurations(arg0);
-    }
-
-    public void setTestEntries(List arg0) {
-        super.setTestEntries(arg0);
-    }
-
-    public void setWorkingDirectory(File arg0) {
-        super.setWorkingDirectory(arg0);
-    }
-
-    public void setEnableKerberos(boolean enableKerberos) {
-        super.setEnableKerberos(enableKerberos);
-    }
-
-    public void setHost(InetAddress host) {
-        super.setHost(host);
-    }
-
-    public void setLdapPort(int ldapPort) {
-        super.setLdapPort(ldapPort);
-    }
-
-    public void setLdapsPort(int ldapsPort) {
-        super.setLdapsPort(ldapsPort);
-    }
-
-    public void setMinaServiceRegistry(ServiceRegistry minaServiceRegistry) {
-        super.setMinaServiceRegistry(minaServiceRegistry);
-    }
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jaas.ldap;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.mina.registry.ServiceRegistry;
+
+/**
+ * A mutable version of {@link ServerStartupConfiguration}.
+ *
+ * @version $Rev: 233391 $ $Date: 2005-08-18 16:38:47 -0600 (Thu, 18 Aug 2005) $
+ */
+public class MutableServerStartupConfiguration extends
+        ServerStartupConfiguration
+{
+    private static final long serialVersionUID = 515104910980600099L;
+
+    public MutableServerStartupConfiguration() {
+        super();
+    }
+
+    public void setAllowAnonymousAccess(boolean arg0) {
+        super.setAllowAnonymousAccess(arg0);
+    }
+
+    public void setAuthenticatorConfigurations(Set arg0) {
+        super.setAuthenticatorConfigurations(arg0);
+    }
+
+    public void setBootstrapSchemas(Set arg0) {
+        super.setBootstrapSchemas(arg0);
+    }
+
+    public void setContextPartitionConfigurations(Set arg0) {
+        super.setContextPartitionConfigurations(arg0);
+    }
+
+    public void setInterceptorConfigurations(List arg0) {
+        super.setInterceptorConfigurations(arg0);
+    }
+
+    public void setTestEntries(List arg0) {
+        super.setTestEntries(arg0);
+    }
+
+    public void setWorkingDirectory(File arg0) {
+        super.setWorkingDirectory(arg0);
+    }
+
+    public void setEnableKerberos(boolean enableKerberos) {
+        super.setEnableKerberos(enableKerberos);
+    }
+
+    public void setHost(InetAddress host) {
+        super.setHost(host);
+    }
+
+    public void setLdapPort(int ldapPort) {
+        super.setLdapPort(ldapPort);
+    }
+
+    public void setLdapsPort(int ldapsPort) {
+        super.setLdapsPort(ldapsPort);
+    }
+
+    public void setMinaServiceRegistry(ServiceRegistry minaServiceRegistry) {
+        super.setMinaServiceRegistry(minaServiceRegistry);
+    }
 }

Propchange: incubator/activemq/trunk/activemq-jaas/src/test/java/org/apache/activemq/jaas/ldap/MutableServerStartupConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message