BasicACLPlugin.java
001 /*
002  *  Licensed to the Apache Software Foundation (ASF) under one
003  *  or more contributor license agreements.  See the NOTICE file
004  *  distributed with this work for additional information
005  *  regarding copyright ownership.  The ASF licenses this file
006  *  to you under the Apache License, Version 2.0 (the
007  *  "License"); you may not use this file except in compliance
008  *  with the License.  You may obtain a copy of the License at
009  *
010  *    http://www.apache.org/licenses/LICENSE-2.0
011  *
012  *  Unless required by applicable law or agreed to in writing,
013  *  software distributed under the License is distributed on an
014  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015  *  KIND, either express or implied.  See the License for the
016  *  specific language governing permissions and limitations
017  *  under the License.
018  *
019  *
020  */
021 package org.apache.qpid.server.security.access.plugins;
022 
023 import org.apache.commons.configuration.Configuration;
024 import org.apache.qpid.AMQConnectionException;
025 import org.apache.qpid.framing.AMQShortString;
026 import org.apache.qpid.server.exchange.Exchange;
027 import org.apache.qpid.server.protocol.AMQProtocolSession;
028 import org.apache.qpid.server.queue.AMQQueue;
029 import org.apache.qpid.server.security.access.ACLPlugin;
030 import org.apache.qpid.server.virtualhost.VirtualHost;
031 
032 public abstract class BasicACLPlugin implements ACLPlugin
033 {
034 
035     // Returns true or false if the plugin should authorise or deny the request    
036     protected abstract AuthzResult getResult();
037     
038     @Override
039     public AuthzResult authoriseBind(AMQProtocolSession session, Exchange exch,
040             AMQQueue queue, AMQShortString routingKey)
041     {
042         return getResult();
043     }
044 
045     @Override
046     public AuthzResult authoriseConnect(AMQProtocolSession session,
047             VirtualHost virtualHost)
048     {
049         return getResult();
050     }
051 
052     @Override
053     public AuthzResult authoriseConsume(AMQProtocolSession session, boolean noAck,
054             AMQQueue queue)
055     {
056         return getResult();    
057     }
058 
059     @Override
060     public AuthzResult authoriseConsume(AMQProtocolSession session,
061             boolean exclusive, boolean noAck, boolean noLocal, boolean nowait,
062             AMQQueue queue)
063     {
064         return getResult();
065     }
066 
067     @Override
068     public AuthzResult authoriseCreateExchange(AMQProtocolSession session,
069             boolean autoDelete, boolean durable, AMQShortString exchangeName,
070             boolean internal, boolean nowait, boolean passive,
071             AMQShortString exchangeType)
072     {
073         return getResult();
074     }
075 
076     @Override
077     public AuthzResult authoriseCreateQueue(AMQProtocolSession session,
078             boolean autoDelete, boolean durable, boolean exclusive,
079             boolean nowait, boolean passive, AMQShortString queue)
080     {
081         return getResult();
082     }
083 
084     @Override
085     public AuthzResult authoriseDelete(AMQProtocolSession session, AMQQueue queue)
086     {
087         return getResult();
088     }
089 
090     @Override
091     public AuthzResult authoriseDelete(AMQProtocolSession session, Exchange exchange)
092     {
093         return getResult();
094     }
095 
096     @Override
097     public AuthzResult authorisePublish(AMQProtocolSession session,
098             boolean immediate, boolean mandatory, AMQShortString routingKey,
099             Exchange e)
100     {
101         return getResult();
102     }
103 
104     @Override
105     public AuthzResult authorisePurge(AMQProtocolSession session, AMQQueue queue)
106     {
107         return getResult();
108     }
109 
110     @Override
111     public AuthzResult authoriseUnbind(AMQProtocolSession session, Exchange exch,
112             AMQShortString routingKey, AMQQueue queue)
113     {
114         return getResult();
115     }
116 
117     @Override
118     public void setConfiguration(Configuration config)
119     {
120         // no-op
121     }
122 
123     public boolean supportsTag(String name)
124     {
125         // This plugin doesn't support any tags
126         return false;
127     }
128 
129 }