AbstractACLPlugin.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 package org.apache.qpid.server.security.access.plugins;
22 
23 import org.apache.qpid.framing.AMQShortString;
24 import org.apache.qpid.server.exchange.Exchange;
25 import org.apache.qpid.server.protocol.AMQProtocolSession;
26 import org.apache.qpid.server.queue.AMQQueue;
27 import org.apache.qpid.server.security.access.ACLPlugin;
28 import org.apache.qpid.server.virtualhost.VirtualHost;
29 
30 /**
31  * This ACLPlugin abstains from all votes. Useful if your plugin only cares about a few operations. 
32  */
33 public abstract class AbstractACLPlugin implements ACLPlugin
34 {
35 
36     private static final AuthzResult DEFAULT_ANSWER = AuthzResult.ABSTAIN;
37 
38     public AuthzResult authoriseBind(AMQProtocolSession session, Exchange exch, AMQQueue queue,
39             AMQShortString routingKey)
40     {
41         return DEFAULT_ANSWER;
42     }
43 
44     public AuthzResult authoriseConnect(AMQProtocolSession session, VirtualHost virtualHost)
45     {
46         return DEFAULT_ANSWER;
47     }
48 
49     public AuthzResult authoriseConsume(AMQProtocolSession session, boolean noAck, AMQQueue queue)
50     {
51         return DEFAULT_ANSWER;
52     }
53 
54     public AuthzResult authoriseConsume(AMQProtocolSession session, boolean exclusive, boolean noAck, boolean noLocal,
55             boolean nowait, AMQQueue queue)
56     {
57         return DEFAULT_ANSWER;
58     }
59 
60     public AuthzResult authoriseCreateExchange(AMQProtocolSession session, boolean autoDelete, boolean durable,
61             AMQShortString exchangeName, boolean internal, boolean nowait, boolean passive, AMQShortString exchangeType)
62     {
63         // TODO Auto-generated method stub
64         return null;
65     }
66 
67     public AuthzResult authoriseCreateQueue(AMQProtocolSession session, boolean autoDelete, boolean durable,
68             boolean exclusive, boolean nowait, boolean passive, AMQShortString queue)
69     {
70         return DEFAULT_ANSWER;
71     }
72 
73     public AuthzResult authoriseDelete(AMQProtocolSession session, AMQQueue queue)
74     {
75         return DEFAULT_ANSWER;
76     }
77 
78     public AuthzResult authoriseDelete(AMQProtocolSession session, Exchange exchange)
79     {
80         return DEFAULT_ANSWER;
81     }
82 
83     public AuthzResult authorisePublish(AMQProtocolSession session, boolean immediate, boolean mandatory,
84             AMQShortString routingKey, Exchange e)
85     {
86         return DEFAULT_ANSWER;
87     }
88 
89     public AuthzResult authorisePurge(AMQProtocolSession session, AMQQueue queue)
90     {
91         return DEFAULT_ANSWER;
92     }
93 
94     public AuthzResult authoriseUnbind(AMQProtocolSession session, Exchange exch, AMQShortString routingKey,
95             AMQQueue queue)
96     {
97         return DEFAULT_ANSWER;
98     }
99 }