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);
32 LOG.debug("Creating the AAAFilter");
38 * Adds context clues that aid in debugging. Also initializes the enable
39 * status to correspond with
40 * <code>ServiceProxy.getInstance.getEnabled()</code>.
42 * @see org.apache.shiro.web.servlet.ShiroFilter#init()
45 public void init() throws Exception {
47 LOG.debug("Initializing the AAAFilter");
48 // sets the filter to the startup value. Because of non-determinism in
49 // bundle loading, this passes an instance of itself along so that if
51 // enable status changes, then AAAFilter enable status is changed.
52 setEnabled(ServiceProxy.getInstance().getEnabled(this));
58 * Adds context clues to aid in debugging whether the filter is enabled.
61 * org.apache.shiro.web.servlet.OncePerRequestFilter#setEnabled(boolean)
64 public void setEnabled(final boolean enabled) {
65 super.setEnabled(enabled);
66 LOG.debug("Setting AAAFilter enabled to {}", enabled);