2 * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.aaa.shiro.filters;
11 import org.apache.shiro.web.servlet.ShiroFilter;
12 import org.opendaylight.aaa.shiro.ServiceProxy;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
17 * The RESTCONF AAA JAX-RS 1.X Web Filter. This class is also responsible for
18 * delivering debug information; to enable these debug statements, please issue
19 * the following in the karaf shell:
21 * <code>log:set debug org.opendaylight.aaa.shiro.filters.AAAFilter</code>
23 * @author Ryan Goulding (ryandgoulding@gmail.com)
24 * @see <code>javax.servlet.Filter</code>
25 * @see <code>org.apache.shiro.web.servlet.ShiroFilter</code>
27 public class AAAFilter extends ShiroFilter {
29 private static final Logger LOG = LoggerFactory.getLogger(AAAFilter.class);
33 final String DEBUG_MESSAGE = "Creating the AAAFilter";
34 LOG.debug(DEBUG_MESSAGE);
40 * Adds context clues that aid in debugging. Also initializes the enable
41 * status to correspond with
42 * <code>ServiceProxy.getInstance.getEnabled()</code>.
44 * @see org.apache.shiro.web.servlet.ShiroFilter#init()
47 public void init() throws Exception {
49 final String DEBUG_MESSAGE = "Initializing the AAAFilter";
50 LOG.debug(DEBUG_MESSAGE);
51 // sets the filter to the startup value. Because of non-determinism in
52 // bundle loading, this passes an instance of itself along so that if
54 // enable status changes, then AAAFilter enable status is changed.
55 setEnabled(ServiceProxy.getInstance().getEnabled(this));
61 * Adds context clues to aid in debugging whether the filter is enabled.
64 * org.apache.shiro.web.servlet.OncePerRequestFilter#setEnabled(boolean)
67 public void setEnabled(boolean enabled) {
68 super.setEnabled(enabled);
69 final String DEBUG_MESSAGE = "Setting AAAFilter enabled to " + enabled;
70 LOG.debug(DEBUG_MESSAGE);