01 /*
02 * Licensed to the Apache Software Foundation (ASF) under one
03 * or more contributor license agreements. See the NOTICE file
04 * distributed with this work for additional information
05 * regarding copyright ownership. The ASF licenses this file
06 * to you under the Apache License, Version 2.0 (the
07 * "License"); you may not use this file except in compliance
08 * with the License. You may obtain a copy of the License at
09 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *
19 *
20 */
21 package org.apache.qpid.server.security.access.plugins;
22
23 import org.apache.commons.configuration.Configuration;
24 import org.apache.qpid.AMQConnectionException;
25 import org.apache.qpid.framing.AMQMethodBody;
26 import org.apache.qpid.protocol.AMQConstant;
27 import org.apache.qpid.server.protocol.AMQProtocolSession;
28 import org.apache.qpid.server.security.access.ACLManager;
29 import org.apache.qpid.server.security.access.ACLPlugin;
30 import org.apache.qpid.server.security.access.ACLPluginFactory;
31 import org.apache.qpid.server.security.access.AccessResult;
32 import org.apache.qpid.server.security.access.Permission;
33
34 public class DenyAll extends BasicACLPlugin
35 {
36 public static final ACLPluginFactory FACTORY = new ACLPluginFactory()
37 {
38 public boolean supportsTag(String name)
39 {
40 return false;
41 }
42
43 public ACLPlugin newInstance(Configuration config)
44 {
45 return new DenyAll();
46 }
47 };
48
49 public AccessResult authorise(AMQProtocolSession session,
50 Permission permission, AMQMethodBody body, Object... parameters)
51 throws AMQConnectionException
52 {
53
54 if (ACLManager.getLogger().isInfoEnabled())
55 {
56 ACLManager.getLogger().info(
57 "Denying user:" + session.getAuthorizedID());
58 }
59 throw body.getConnectionException(AMQConstant.ACCESS_REFUSED,
60 "DenyAll Plugin");
61 }
62
63 public String getPluginName()
64 {
65 return getClass().getSimpleName();
66 }
67
68 @Override
69 protected AuthzResult getResult()
70 {
71 // Always deny
72 return AuthzResult.DENIED;
73 }
74
75 }
|