View Javadoc

1   /*** 
2    * 
3    * Copyright 2004 Protique Ltd
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); 
6    * you may not use this file except in compliance with the License. 
7    * You may obtain a copy of the License at 
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, 
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
14   * See the License for the specific language governing permissions and 
15   * limitations under the License. 
16   * 
17   **/
18  package org.codehaus.activemq.security;
19  
20  import org.codehaus.activemq.broker.BrokerClient;
21  import org.codehaus.activemq.message.ActiveMQMessage;
22  import org.codehaus.activemq.message.ConnectionInfo;
23  import org.codehaus.activemq.message.ConsumerInfo;
24  import org.codehaus.activemq.message.ProducerInfo;
25  
26  import javax.jms.JMSException;
27  
28  /***
29   * A pluggable strategy to authenticate new connections and authorize
30   * the connection and producer and consumer on destinations
31   *
32   * @version $Revision: 1.1 $
33   */
34  public interface SecurityAdapter {
35  
36      /***
37       * Authenticates the connection and authorizes it for use with this
38       * Message Broker
39       *
40       * @throws JMSException if the connection is not allowed for any reason
41       */
42      public void authorizeConnection(BrokerClient client, ConnectionInfo info) throws JMSException;
43  
44      /***
45       * Authorizes that the consumer can start with the given consumer information
46       *
47       * @throws JMSException if the connection is not allowed for any reason
48       */
49      public void authorizeConsumer(BrokerClient client, ConsumerInfo info) throws JMSException;
50  
51      /***
52       * Authorizes that the prodcuer can start with the given producer information.
53       * Note that the destination information may not be present at the start of the producer.
54       *
55       * @throws JMSException if the connection is not allowed for any reason
56       */
57      public void authorizeProducer(BrokerClient client, ProducerInfo info) throws JMSException;
58  
59      /***
60       * Authorizes on a per message basis whether or not the client is allowed to send the given
61       * message. The client may not have been authorized yet for this destination as a destination
62       * may not have been specified on the previous call to
63       * {@link #authorizeProducer(org.codehaus.activemq.broker.BrokerClient, org.codehaus.activemq.message.ProducerInfo)}
64       */
65      public void authorizeSendMessage(BrokerClient client, ActiveMQMessage message) throws JMSException;
66  }