Fw: OpenJms and Security

"Knut at work" <knut.lerpold-Y0ltV1YbkABUXjr8k6HNnAC/[email protected]>
Newsgroups gmane.comp.java.openjms.devel
Message-ID <[email protected]>
Sorry, forgot to supply the changelog.

Also the only way to add new users is thru the openjms.xml file. 
Have not done any changes to the Admin yet.


Knut
----- Original Message ----- 
From: Knut at work 
To: openjms-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org 
Sent: Tuesday, July 22, 2003 6:09 PM
Subject: OpenJms and Security


Hello!

I have developed a solution for authentication of users in OpenJMS.

This is just a very first 'shot' and I would be pleased if any of you guys who knows the code would be so kind to have a look. I have only studied the source for a couple of days so maybe ive choosed some stupid solutions :-)

Limitations:
-By the time only authentication of user/password, nothing for Acl against Queue/Topic.
-username/password are beeing transferd from client to server in plaintext
-Only implemented for the TCP-connector
-Only impl. for RDBMS and tested against MySql


The source is taken from the openjms-0.7.5-src.

Howto:
unpack openjms-0.7.5-src.zip
Unpack the src.zip to ../main/.. in openjms-0.7.5-src catalog
Unpack the config.zip to ../config in openjms-0.7.5-src catalog
and build.

Add suitable drivers for the DB
and run.

openjms.xml
-------------------
if you set <SecurityConfiguration enableSecurity="false"/> openjms should behave ex. as before (i hope....)


Knut
changelog.txt (text/plain, 37 KB)
client:
-----------

Index: jms/client/JmsConnection.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/JmsConnection.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 JmsConnection.java
43c43
<  * $Id: JmsConnection.java,v 1.1.1.1 2003/07/22 11:10:44 knut.lerpold Exp $
---
>  * $Id: JmsConnection.java,v 1.20 2003/01/23 02:48:00 tanderson Exp $
71c71
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:44 $
---
>  * @version     $Revision: 1.20 $ $Date: 2003/01/23 02:48:00 $
153a154,155
>      * @param       username    client username
>      * @param       password    client password
156c158
<     JmsConnection(JmsConnectionFactory factory, String id)
---
>     JmsConnection(JmsConnectionFactory factory, String id, String username, String password)
171c173
<             _stub = factory.getProxy().createConnection(_clientId);
---
>             _stub = factory.getProxy().createConnection(_clientId,username,password);
Index: jms/client/JmsQueueConnection.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/JmsQueueConnection.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 JmsQueueConnection.java
43c43
<  * $Id: JmsQueueConnection.java,v 1.1.1.1 2003/07/22 11:10:44 knut.lerpold Exp $
---
>  * $Id: JmsQueueConnection.java,v 1.7 2001/09/18 10:50:33 jima Exp $
63c63
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:44 $
---
>  * @version     $Revision: 1.7 $ $Date: 2001/09/18 10:50:33 $
82a83,84
>      * @param       username    client username
>      * @param       password    client password
85c87
<     JmsQueueConnection(JmsQueueConnectionFactory factory, String id)
---
>     JmsQueueConnection(JmsQueueConnectionFactory factory, String id, String username, String password)
88c90
<         super(factory, id);
---
>         super(factory, id, username, password);
Index: jms/client/JmsQueueConnectionFactory.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/JmsQueueConnectionFactory.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 JmsQueueConnectionFactory.java
43c43
<  * $Id: JmsQueueConnectionFactory.java,v 1.1.1.1 2003/07/22 11:10:44 knut.lerpold Exp $
---
>  * $Id: JmsQueueConnectionFactory.java,v 1.10 2001/07/27 05:03:15 jima Exp $
69c69
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:44 $
---
>  * @version     $Revision: 1.10 $ $Date: 2001/07/27 05:03:15 $
119c119
<         connection = new JmsQueueConnection(this, id);
---
>         connection = new JmsQueueConnection(this, id, userName, password);
Index: jms/client/JmsServerStubIfc.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/JmsServerStubIfc.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 JmsServerStubIfc.java
43c43
<  * $Id: JmsServerStubIfc.java,v 1.1.1.1 2003/07/22 11:10:44 knut.lerpold Exp $
---
>  * $Id: JmsServerStubIfc.java,v 1.3 2001/05/24 15:25:11 jima Exp $
57c57
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:44 $
---
>  * @version     $Revision: 1.3 $ $Date: 2001/05/24 15:25:11 $
66a67,68
>      * @param       username            clients username
>      * @param       password            clients password
69c71
<     public JmsConnectionStubIfc createConnection(String id)
---
>     public JmsConnectionStubIfc createConnection(String id, String username, String password)
Index: jms/client/JmsTopicConnection.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/JmsTopicConnection.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 JmsTopicConnection.java
43c43
<  * $Id: JmsTopicConnection.java,v 1.1.1.1 2003/07/22 11:10:45 knut.lerpold Exp $
---
>  * $Id: JmsTopicConnection.java,v 1.8 2001/09/18 10:50:33 jima Exp $
61c61
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:45 $
---
>  * @version     $Revision: 1.8 $ $Date: 2001/09/18 10:50:33 $
80a81,82
>      * @param       username        client username
>      * @param       password        client password
83c85
<     public JmsTopicConnection(JmsTopicConnectionFactory factory, String id)
---
>     public JmsTopicConnection(JmsTopicConnectionFactory factory, String id, String username, String password)
86c88
<         super(factory, id);
---
>         super(factory, id, username, password);
Index: jms/client/JmsTopicConnectionFactory.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/JmsTopicConnectionFactory.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 JmsTopicConnectionFactory.java
43c43
<  * $Id: JmsTopicConnectionFactory.java,v 1.1.1.1 2003/07/22 11:10:45 knut.lerpold Exp $
---
>  * $Id: JmsTopicConnectionFactory.java,v 1.13 2001/11/20 20:56:24 tima Exp $
72c72
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:45 $
---
>  * @version     $Revision: 1.13 $ $Date: 2001/11/20 20:56:24 $
115c115
<         JmsTopicConnection connection = new JmsTopicConnection(this, id);
---
>         JmsTopicConnection connection = new JmsTopicConnection(this, id, userName, password);
Index: jms/client/JmsXAQueueConnection.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/JmsXAQueueConnection.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 JmsXAQueueConnection.java
43c43
<  * $Id: JmsXAQueueConnection.java,v 1.1.1.1 2003/07/22 11:10:45 knut.lerpold Exp $
---
>  * $Id: JmsXAQueueConnection.java,v 1.2 2002/03/12 11:57:31 jima Exp $
60c60
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:45 $
---
>  * @version     $Revision: 1.2 $ $Date: 2002/03/12 11:57:31 $
80a81,82
>      * @param       username        client username
>      * @param       password        client password
83c85
<     public JmsXAQueueConnection(JmsXAQueueConnectionFactory factory, String id)
---
>     public JmsXAQueueConnection(JmsXAQueueConnectionFactory factory, String id, String username, String password)
85c87
<         super(factory, id);
---
>         super(factory, id, username, password);
Index: jms/client/JmsXAQueueConnectionFactory.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/JmsXAQueueConnectionFactory.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 JmsXAQueueConnectionFactory.java
43c43
<  * $Id: JmsXAQueueConnectionFactory.java,v 1.1.1.1 2003/07/22 11:10:45 knut.lerpold Exp $
---
>  * $Id: JmsXAQueueConnectionFactory.java,v 1.3 2002/03/12 11:57:31 jima Exp $
72c72
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:45 $
---
>  * @version     $Revision: 1.3 $ $Date: 2002/03/12 11:57:31 $
106c106
<         return new JmsXAQueueConnection(this, UUID.next());
---
>         return createXAQueueConnection(null, null);
113c113
<         throw new JMSException("createXAQueueConnection(String, String) not implemented");
---
>         return new JmsXAQueueConnection(this, UUID.next(),userName, password);
Index: jms/client/JmsXATopicConnection.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/JmsXATopicConnection.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 JmsXATopicConnection.java
43c43
<  * $Id: JmsXATopicConnection.java,v 1.1.1.1 2003/07/22 11:10:45 knut.lerpold Exp $
---
>  * $Id: JmsXATopicConnection.java,v 1.2 2002/03/12 11:57:31 jima Exp $
61c61
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:45 $
---
>  * @version     $Revision: 1.2 $ $Date: 2002/03/12 11:57:31 $
81a82,83
>      * @param       username        client username
>      * @param       password        client password
84c86
<     public JmsXATopicConnection(JmsXATopicConnectionFactory factory, String id)
---
>     public JmsXATopicConnection(JmsXATopicConnectionFactory factory, String id, String username, String password)
86c88
<         super(factory, id);
---
>         super(factory, id, username, password);
Index: jms/client/JmsXATopicConnectionFactory.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/JmsXATopicConnectionFactory.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 JmsXATopicConnectionFactory.java
43c43
<  * $Id: JmsXATopicConnectionFactory.java,v 1.1.1.1 2003/07/22 11:10:45 knut.lerpold Exp $
---
>  * $Id: JmsXATopicConnectionFactory.java,v 1.3 2002/03/12 11:57:31 jima Exp $
71c71
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:45 $
---
>  * @version     $Revision: 1.3 $ $Date: 2002/03/12 11:57:31 $
105c105
<         return new JmsXATopicConnection(this, UUID.next());
---
>         return createXATopicConnection(null, null);
111c111
<         throw new JMSException("createXATopicConnection(String, String) not implemented");
---
>         return new JmsXATopicConnection(this, UUID.next(),userName, password);
Index: jms/client/http/HttpJmsServerStub.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/http/HttpJmsServerStub.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 HttpJmsServerStub.java
43c43
<  * $Id: HttpJmsServerStub.java,v 1.1.1.1 2003/07/22 11:10:45 knut.lerpold Exp $
---
>  * $Id: HttpJmsServerStub.java,v 1.5 2003/03/26 11:43:42 tanderson Exp $
56a57
> import javax.jms.JMSSecurityException;
71c72
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:45 $
---
>  * @version     $Revision: 1.5 $ $Date: 2003/03/26 11:43:42 $
124a126,127
>      * @param       username  client username
>      * @param       password  client password
127c130
<     public JmsConnectionStubIfc createConnection(String clientId)
---
>     public JmsConnectionStubIfc createConnection(String clientId, String username, String password)
132c135
<             Vector v = pack("createConnection", clientId);
---
>             Vector v = pack("createConnection", clientId, username, password);
144,145c147,154
<                     throw new JMSException("Failed to createConnection  " 
<                                            + (String)v.get(1));
---
>                     Boolean securityFault = (Boolean)v.get(2);
>                     if(securityFault.booleanValue()){
>                         throw new JMSSecurityException((String)v.get(1));
>                     }
>                     else{
>                         throw new JMSException("Failed to create connection:  "
>                             + v.get(1));
>                     }
160d168
< 
171a180,181
>      * @param username
>      * @param password
173d182
<      *
175,176c184,185
<     private Vector pack(String method, String id) {
<         Vector v = new Vector(3);
---
>     private Vector pack(String method, String id, String username, String password) {
>         Vector v = new Vector(4);
179a189
>         v.add(username + ";" + password);
Index: jms/client/http/SslHttpJmsServerStub.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/http/SslHttpJmsServerStub.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 SslHttpJmsServerStub.java
46c46
<  * $Id: SslHttpJmsServerStub.java,v 1.1.1.1 2003/07/22 11:10:45 knut.lerpold Exp $
---
>  * $Id: SslHttpJmsServerStub.java,v 1.3 2003/03/26 11:56:16 tanderson Exp $
59a60
> import javax.jms.JMSSecurityException;
74c75
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:45 $
---
>  * @version     $Revision: 1.3 $ $Date: 2003/03/26 11:56:16 $
126a128,129
>      * @param username 
>      * @param password 
129c132
<     public JmsConnectionStubIfc createConnection(String clientId)
---
>     public JmsConnectionStubIfc createConnection(String clientId, String username, String password)
141c144
<             Vector v = pack("createConnection", clientId);
---
>             Vector v = pack("createConnection", clientId, username, password);
154,155c157,164
<                     throw new JMSException("Failed to createConnection  " 
<                                            + (String)v.get(1));
---
>                     Boolean securityFault = (Boolean)v.get(2);
>                     if(securityFault.booleanValue()){
>                         throw new JMSSecurityException((String)v.get(1));
>                     }
>                     else{
>                         throw new JMSException("Failed to create connection:  "
>                             + v.get(1));
>                     }
178a188,189
>      * @param username	
>      * @param password
182,183c193,194
<     private Vector pack(String method, String id) {
<         Vector v = new Vector(3);
---
>     private Vector pack(String method, String id, String username, String password) {
>         Vector v = new Vector(4);
186a198
>         v.add(username + ";" + password);
cvs diff: Diffing jms/client/http/servlet
Index: jms/client/intravm/IntravmJmsServerStub.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/intravm/IntravmJmsServerStub.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 IntravmJmsServerStub.java
43c43
<  * $Id: IntravmJmsServerStub.java,v 1.1.1.1 2003/07/22 11:10:45 knut.lerpold Exp $
---
>  * $Id: IntravmJmsServerStub.java,v 1.4 2001/05/24 15:34:36 jima Exp $
65c65
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:45 $
---
>  * @version     $Revision: 1.4 $ $Date: 2001/05/24 15:34:36 $
93a94,95
>      * @param       username  client username
>      * @param       password  client password
97c99
<     public JmsConnectionStubIfc createConnection(String id)
---
>     public JmsConnectionStubIfc createConnection(String id, String username, String password)
131d132
< 
Index: jms/client/mipc/IpcJmsServerStub.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/mipc/IpcJmsServerStub.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 IpcJmsServerStub.java
43c43
<  * $Id: IpcJmsServerStub.java,v 1.1.1.1 2003/07/22 11:10:46 knut.lerpold Exp $
---
>  * $Id: IpcJmsServerStub.java,v 1.14 2003/02/16 02:04:20 tanderson Exp $
57a58
> import javax.jms.JMSSecurityException;
76c77
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:46 $
---
>  * @version     $Revision: 1.14 $ $Date: 2003/02/16 02:04:20 $
183a185,186
>      * @param       username  client username
>      * @param       password  client password
187c190
<     public synchronized JmsConnectionStubIfc createConnection(String clientId)
---
>     public synchronized JmsConnectionStubIfc createConnection(String clientId, String username, String password)
193c196
<             Vector v = pack("createConnection", clientId);
---
>             Vector v = pack("createConnection", clientId, username, password);
206a210,214
>                     Boolean securityFault = (Boolean)v.get(2);
>                     if(securityFault.booleanValue()){
>                         throw new JMSSecurityException((String)v.get(1));
>                     }
>                     else{
209a218
>                 }
367a377,378
>      * @param username
>      * @param password
370,371c381,382
<     private Vector pack(String method, String id) {
<         Vector v = new Vector(3);
---
>     private Vector pack(String method, String id, String username, String password) {
>         Vector v = new Vector(4);
374a386
>         v.add(username + ";" + password);
376a389
> 
Index: jms/client/rmi/RmiJmsServerStub.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/client/rmi/RmiJmsServerStub.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 RmiJmsServerStub.java
43c43
<  * $Id: RmiJmsServerStub.java,v 1.1.1.1 2003/07/22 11:10:46 knut.lerpold Exp $
---
>  * $Id: RmiJmsServerStub.java,v 1.12 2003/03/24 11:56:29 tanderson Exp $
76c76
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:46 $
---
>  * @version     $Revision: 1.12 $ $Date: 2003/03/24 11:56:29 $
166a167,168
>      * @param       username  client username
>      * @param       password  client password
170c172
<     public JmsConnectionStubIfc createConnection(String id)
---
>     public JmsConnectionStubIfc createConnection(String id, String username, String password)



config:
-------

new files (aut. generated by Castor):
	 	SecurityConfigurator.java
		SecurityConfiguratorDescriptor.java
		Users.java
		UsersDescriptor.java
		User.java
		UserDescriptor.java



Index: jms/config/Configuration.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/config/Configuration.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 Configuration.java
5c5
<  * $Id: Configuration.java,v 1.1.1.1 2003/07/22 11:10:47 knut.lerpold Exp $
---
>  * $Id$
32c32
<  * @version $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:47 $
---
>  * @version $Revision$ $Date$
178a179,187
>      *         This element defines items specific to the OpenJMS
>      * server.
>      *         By default, OpenJMS uses no security.
>      *       
>     **/
>     private SecurityConfiguration _securityConfiguration;
> 
>     /**
>      * 
200a210,217
>      *         This element is used to bootstrap the creation of
>      * Users.
>      *       
>     **/
>     private Users _users;
> 
>     /**
>      * 
321a339,345
>     public SecurityConfiguration getSecurityConfiguration()
>     {
>         return this._securityConfiguration;
>     } //-- SecurityConfiguration getSecurityConfiguration() 
> 
>     /**
>     **/
342a367,373
>     public Users getUsers()
>     {
>         return this._users;
>     } //-- Users getUsers() 
> 
>     /**
>     **/
503a535,543
>      * @param securityConfiguration
>     **/
>     public void setSecurityConfiguration(SecurityConfiguration securityConfiguration)
>     {
>         this._securityConfiguration = securityConfiguration;
>     } //-- void setSecurityConfiguration(SecurityConfiguration) 
> 
>     /**
>      * 
527a568,576
> 
>     /**
>      * 
>      * @param users
>     **/
>     public void setUsers(Users users)
>     {
>         this._users = users;
>     } //-- void setUsers(Users) 
Index: jms/config/ConfigurationDescriptor.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/config/ConfigurationDescriptor.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 ConfigurationDescriptor.java
5c5
<  * $Id: ConfigurationDescriptor.java,v 1.1.1.1 2003/07/22 11:10:47 knut.lerpold Exp $
---
>  * $Id$
27c27
<  * @version $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:47 $
---
>  * @version $Revision$ $Date$
561a562,594
>         //-- _securityConfiguration
>         desc = new XMLFieldDescriptorImpl(SecurityConfiguration.class, "_securityConfiguration", "SecurityConfiguration", NodeType.Element);
>         handler = (new XMLFieldHandler() {
>             public Object getValue( Object object ) 
>                 throws IllegalStateException
>             {
>                 Configuration target = (Configuration) object;
>                 return target.getSecurityConfiguration();
>             }
>             public void setValue( Object object, Object value) 
>                 throws IllegalStateException, IllegalArgumentException
>             {
>                 try {
>                     Configuration target = (Configuration) object;
>                     target.setSecurityConfiguration( (SecurityConfiguration) value);
>                 }
>                 catch (Exception ex) {
>                     throw new IllegalStateException(ex.toString());
>                 }
>             }
>             public Object newInstance( Object parent ) {
>                 return new SecurityConfiguration();
>             }
>         } );
>         desc.setHandler(handler);
>         desc.setNameSpaceURI("http://openjms.exolab.org/configuration");
>         desc.setMultivalued(false);
>         addFieldDescriptor(desc);
>         
>         //-- validation code for: _securityConfiguration
>         fieldValidator = new FieldValidator();
>         desc.setValidator(fieldValidator);
>         
591a625,657
>         fieldValidator = new FieldValidator();
>         desc.setValidator(fieldValidator);
>         
>         //-- _users
>         desc = new XMLFieldDescriptorImpl(Users.class, "_users", "Users", NodeType.Element);
>         handler = (new XMLFieldHandler() {
>             public Object getValue( Object object ) 
>                 throws IllegalStateException
>             {
>                 Configuration target = (Configuration) object;
>                 return target.getUsers();
>             }
>             public void setValue( Object object, Object value) 
>                 throws IllegalStateException, IllegalArgumentException
>             {
>                 try {
>                     Configuration target = (Configuration) object;
>                     target.setUsers( (Users) value);
>                 }
>                 catch (Exception ex) {
>                     throw new IllegalStateException(ex.toString());
>                 }
>             }
>             public Object newInstance( Object parent ) {
>                 return new Users();
>             }
>         } );
>         desc.setHandler(handler);
>         desc.setNameSpaceURI("http://openjms.exolab.org/configuration");
>         desc.setMultivalued(false);
>         addFieldDescriptor(desc);
>         
>         //-- validation code for: _users
Index: jms/config/ConfigurationLoader.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/config/ConfigurationLoader.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 ConfigurationLoader.java
43c43
<  * $Id: ConfigurationLoader.java,v 1.1.1.1 2003/07/22 11:10:47 knut.lerpold Exp $
---
>  * $Id: ConfigurationLoader.java,v 1.4 2002/10/04 00:05:24 jalateras Exp $
66c66
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:47 $
---
>  * @version     $Revision: 1.4 $ $Date: 2002/10/04 00:05:24 $
125a126,129
>         if (config.getSecurityConfiguration() == null) {
>             config.setSecurityConfiguration(
>                 defaults.getSecurityConfiguration());
>         }        
Index: jms/config/DefaultConfiguration.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/config/DefaultConfiguration.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 DefaultConfiguration.java
5c5
<  * $Id: DefaultConfiguration.java,v 1.1.1.1 2003/07/22 11:10:47 knut.lerpold Exp $
---
>  * $Id$
31c31
<  * @version $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:47 $
---
>  * @version $Revision$ $Date$
149a150,158
>     /**
>      * 
>      *         This element defines items specific to the OpenJMS
>      * server.
>      *         By default, OpenJMS uses no security.
>      *       
>     **/
>     private SecurityConfiguration _securityConfiguration;
> 
228a238,244
>     public SecurityConfiguration getSecurityConfiguration()
>     {
>         return this._securityConfiguration;
>     } //-- SecurityConfiguration getSecurityConfiguration() 
> 
>     /**
>     **/
362a379,387
> 
>     /**
>      * 
>      * @param securityConfiguration
>     **/
>     public void setSecurityConfiguration(SecurityConfiguration securityConfiguration)
>     {
>         this._securityConfiguration = securityConfiguration;
>     } //-- void setSecurityConfiguration(SecurityConfiguration) 
Index: jms/config/DefaultConfigurationDescriptor.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/config/DefaultConfigurationDescriptor.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 DefaultConfigurationDescriptor.java
5c5
<  * $Id: DefaultConfigurationDescriptor.java,v 1.1.1.1 2003/07/22 11:10:47 knut.lerpold Exp $
---
>  * $Id$
27c27
<  * @version $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:47 $
---
>  * @version $Revision$ $Date$
478a479,513
>         fieldValidator = new FieldValidator();
>         fieldValidator.setMinOccurs(1);
>         desc.setValidator(fieldValidator);
>         
>         //-- _securityConfiguration
>         desc = new XMLFieldDescriptorImpl(SecurityConfiguration.class, "_securityConfiguration", "SecurityConfiguration", NodeType.Element);
>         handler = (new XMLFieldHandler() {
>             public Object getValue( Object object ) 
>                 throws IllegalStateException
>             {
>                 DefaultConfiguration target = (DefaultConfiguration) object;
>                 return target.getSecurityConfiguration();
>             }
>             public void setValue( Object object, Object value) 
>                 throws IllegalStateException, IllegalArgumentException
>             {
>                 try {
>                     DefaultConfiguration target = (DefaultConfiguration) object;
>                     target.setSecurityConfiguration( (SecurityConfiguration) value);
>                 }
>                 catch (Exception ex) {
>                     throw new IllegalStateException(ex.toString());
>                 }
>             }
>             public Object newInstance( Object parent ) {
>                 return new SecurityConfiguration();
>             }
>         } );
>         desc.setHandler(handler);
>         desc.setNameSpaceURI("http://openjms.exolab.org/configuration");
>         desc.setRequired(true);
>         desc.setMultivalued(false);
>         addFieldDescriptor(desc);
>         
>         //-- validation code for: _securityConfiguration
Index: jms/config/openjms.xsd
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/config/openjms.xsd,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 openjms.xsd
47a48
>         <xsd:element ref="SecurityConfiguration" minOccurs="0" />
48a50
>         <xsd:element ref="Users" minOccurs="0" />
77a80
>         <xsd:element ref="SecurityConfiguration" />
116a120,141
>   <xsd:element name="SecurityConfiguration">
>     <xsd:annotation>
>       <xsd:documentation xml:lang="en">
>         This element defines items specific to the OpenJMS server.
>         By default, OpenJMS uses no security.
>       </xsd:documentation>
>     </xsd:annotation>
>     <xsd:complexType>
>       <xsd:attribute name="securityEnabled" type="xsd:string" use="optional" 
>                      default="false">
>         <xsd:annotation>
>           <xsd:documentation xml:lang="en">
>             The host address of the OpenJMS server. This will typically be
>             'localhost'. If the host machine has multiple NICs, then 
>             the host will need to be specified.
>           </xsd:documentation>
>         </xsd:annotation>
>       </xsd:attribute>
> 
>     </xsd:complexType>
>   </xsd:element>
> 
873a899,936
>   
>   <xsd:element name="Users">
>     <xsd:annotation>
>       <xsd:documentation xml:lang="en">
>         This element is used to bootstrap the creation of Users.
>       </xsd:documentation>
>     </xsd:annotation>
>     <xsd:complexType>
>       <xsd:sequence>
>         <xsd:element name="User" minOccurs="0" 
>                      maxOccurs="unbounded">
>           <xsd:annotation>
>             <xsd:documentation xml:lang="en">
>               This element defines an User.
>             </xsd:documentation>
>           </xsd:annotation>
>           <xsd:complexType>
>             <xsd:attribute name="name" type="xsd:string" use="required">
>               <xsd:annotation>
>                 <xsd:documentation xml:lang="en">
>                   The name of the user.
>                 </xsd:documentation>
>               </xsd:annotation>
>             </xsd:attribute>
>             <xsd:attribute name="password" type="xsd:string" use="required">
>               <xsd:annotation>
>                 <xsd:documentation xml:lang="en">
>                   The password of the user.
>                 </xsd:documentation>
>               </xsd:annotation>
>             </xsd:attribute>
>           </xsd:complexType>
>         </xsd:element>
>         
>       </xsd:sequence>
>     </xsd:complexType>
>   </xsd:element>
>   
Index: jms/config/openjms_defaults.xml
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/config/openjms_defaults.xml,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 openjms_defaults.xml
58a59,60
>   <SecurityConfiguration securityEnabled="false" />
>   
cvs diff: Diffing jms/config/types



persistence:
------------

new file:
	 	Users.java


Index: jms/persistence/BatchingRdbmsAdapter.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/persistence/BatchingRdbmsAdapter.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 BatchingRdbmsAdapter.java
43c43
<  * $Id: BatchingRdbmsAdapter.java,v 1.1.1.1 2003/07/22 11:10:53 knut.lerpold Exp $
---
>  * $Id: BatchingRdbmsAdapter.java,v 1.5 2003/03/23 05:52:23 tanderson Exp $
117c117
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:53 $
---
>  * @version     $Revision: 1.5 $ $Date: 2003/03/23 05:52:23 $
709a710,726
>     }
>     
>     public void addUser(Connection connection, org.exolab.jms.authentication.User user) throws PersistenceException {
>     }
>     
>     public Enumeration getAllUsers(Connection connection) throws PersistenceException {
>         return null;
>     }
>     
>     public org.exolab.jms.authentication.User getUser(Connection connection, org.exolab.jms.authentication.User user) throws PersistenceException {
>         return null;
>     }
>     
>     public void removeUser(Connection connection, org.exolab.jms.authentication.User user) throws PersistenceException {
>     }
>     
>     public void updateUser(Connection connection, org.exolab.jms.authentication.User user) throws PersistenceException {
Index: jms/persistence/ObjectAdapter.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/persistence/ObjectAdapter.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 ObjectAdapter.java
43c43
<  * $Id: ObjectAdapter.java,v 1.1.1.1 2003/07/22 11:10:53 knut.lerpold Exp $
---
>  * $Id: ObjectAdapter.java,v 1.25 2003/03/23 05:52:23 tanderson Exp $
124c124
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:53 $
---
>  * @version     $Revision: 1.25 $ $Date: 2003/03/23 05:52:23 $
1983a1984,2001
>     
>     public void addUser(Connection connection, org.exolab.jms.authentication.User user) throws PersistenceException {
>     }
>     
>     public Enumeration getAllUsers(Connection connection) throws PersistenceException {
>         return null;
>     }
>     
>     public org.exolab.jms.authentication.User getUser(Connection connection, org.exolab.jms.authentication.User user) throws PersistenceException {
>         return null;
>     }
>     
>     public void removeUser(Connection connection, org.exolab.jms.authentication.User user) throws PersistenceException {
>     }
>     
>     public void updateUser(Connection connection, org.exolab.jms.authentication.User user) throws PersistenceException {
>     }
>     
Index: jms/persistence/PersistenceAdapter.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/persistence/PersistenceAdapter.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 PersistenceAdapter.java
43c43
<  * $Id: PersistenceAdapter.java,v 1.1.1.1 2003/07/22 11:10:53 knut.lerpold Exp $
---
>  * $Id: PersistenceAdapter.java,v 1.35 2002/10/04 00:05:25 jalateras Exp $
73a74
> import org.exolab.jms.authentication.User;
82c83
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:53 $
---
>  * @version     $Revision: 1.35 $ $Date: 2002/10/04 00:05:25 $
420a422,442
>     
>     
>     public abstract Enumeration getAllUsers(Connection connection)
>     throws PersistenceException;
>     
>     public abstract void addUser(Connection connection,
>                                         User user)
>     throws PersistenceException;
> 
>     public abstract void removeUser(Connection connection,
>                                         User user)
>     throws PersistenceException;
> 
>     public abstract void updateUser(Connection connection,
>                                         User user)
>     throws PersistenceException;
> 
>     public abstract User getUser(Connection connection,
>                                         User user)
>     throws PersistenceException;
> 
Index: jms/persistence/RDBMSAdapter.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/persistence/RDBMSAdapter.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 RDBMSAdapter.java
43c43
<  * $Id: RDBMSAdapter.java,v 1.1.1.1 2003/07/22 11:10:53 knut.lerpold Exp $
---
>  * $Id: RDBMSAdapter.java,v 1.42 2003/03/23 05:52:23 tanderson Exp $
105a106
> import org.exolab.jms.authentication.User;
117c118
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:53 $
---
>  * @version     $Revision: 1.42 $ $Date: 2003/03/23 05:52:23 $
261a263
>             Users.initialise(connection);
332a335,338
>         
>         if (Users.instance() != null) {
>             Users.instance().close();
>         }
895a902,922
>     
>     public void addUser(Connection connection, User user) throws PersistenceException {
>         Users.instance().add(connection, user);
>     }
>     
>     public Enumeration getAllUsers(Connection connection) throws PersistenceException {
>         return Users.instance().getAllUsers(connection).elements();
>     }
>     
>     public User getUser(Connection connection, User user) throws PersistenceException {
>         return Users.instance().get(connection, user);
>     }
>     
>     public void removeUser(Connection connection, User user) throws PersistenceException {
>         Users.instance().remove(connection, user);
>     }
>     
>     public void updateUser(Connection connection, User user) throws PersistenceException {
>         Users.instance().update(connection, user);
>     }
>     


server:
--------------------

Index: jms/server/JmsServer.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/server/JmsServer.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 JmsServer.java
43c43
<  * $Id: JmsServer.java,v 1.1.1.1 2003/07/22 11:10:56 knut.lerpold Exp $
---
>  * $Id: JmsServer.java,v 1.41 2003/03/23 05:44:48 tanderson Exp $
82a83,84
> import org.exolab.jms.authentication.AuthenticationMgr;
> import org.exolab.jms.authentication.UserManager;
90c92
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:56 $
---
>  * @version     $Revision: 1.41 $ $Date: 2003/03/23 05:44:48 $
175a178,182
>         //create and bind users
>         UserManager.instance().registerConfiguredUsers();
>         
>         //create and bind Acls
>         
280a288,291
>         
>         // add the authentication manager
>         _services.add(AuthenticationMgr.createInstance().getName(),
>                       AuthenticationMgr.createInstance());
Index: jms/server/mipc/IpcJmsServerConnection.java
===================================================================
RCS file: d:/CvsOpenJms/org/exolab/jms/server/mipc/IpcJmsServerConnection.java,v
retrieving revision 1.1.1.1
diff -w -r1.1.1.1 IpcJmsServerConnection.java
43c43
<  * $Id: IpcJmsServerConnection.java,v 1.1.1.1 2003/07/22 11:10:57 knut.lerpold Exp $
---
>  * $Id: IpcJmsServerConnection.java,v 1.5 2003/01/23 10:43:39 tanderson Exp $
59a60
> import org.exolab.jms.authentication.AuthenticationMgr;
66c67
<  * @version     $Revision: 1.1.1.1 $ $Date: 2003/07/22 11:10:57 $
---
>  * @version     $Revision: 1.5 $ $Date: 2003/01/23 10:43:39 $
102d102
<             //result = createConnection((String)v.get(2));
104c104
<             result = createConnection(id, (String) v.get(2));
---
>             result = createConnection(id, (String) v.get(2), (String)v.get(3));
190c190
<                             "connection");
---
>                             "connection",new Boolean(false));
197a198,220
>      * A new connection request has been made.
>      * Pass on the request to the JmsServerConnectionMgr. If the request 
>      * succeeds return the connectionId to the client.
>      *
>      * @param ipcId The unique IPC id of this connection.
>      * @param clientId The unique id of the client.
>      * @param usernamePassword The username and password separated with ';'
>      * @return Vector The result of the request.
>      */
>     private Vector createConnection(String ipcId, String clientId, String usernamePassword) {
>         String username = usernamePassword.substring(0,usernamePassword.indexOf(';'));
>         String password = usernamePassword.substring(usernamePassword.indexOf(';') + 1);
>         
>         if(AuthenticationMgr.instance().validateUser(username, password))
>             return createConnection(ipcId, clientId);
>         else{
>                 return pack(new Boolean(false), 
>                             "Failed to authenticate user '" + username + "'.",
>                             new Boolean(true));
>             }
>     }
> 
>     /**
270a294,302
>         return v;
>     }
> 
>     private Vector pack(Boolean success, Object ob, Boolean securityFault)
>     {
>         Vector v = new Vector(3);
>         v.add(success);
>         v.add(ob);
>         v.add(securityFault);



new package: authentication
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.