View Javadoc

1   /* Copyright 2004 Acegi Technology Pty Limited
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  
16  package org.acegisecurity.securechannel;
17  
18  import org.acegisecurity.ConfigAttribute;
19  import org.acegisecurity.ConfigAttributeDefinition;
20  import org.acegisecurity.intercept.web.FilterInvocation;
21  
22  import java.io.IOException;
23  
24  import javax.servlet.ServletException;
25  
26  
27  /***
28   * Decides whether a web channel provides sufficient security.
29   * 
30   * <P>
31   * If necessary due to the nature of the redirection, implementations should
32   * store the original destination of the request in {@link
33   * org.acegisecurity.ui.AbstractProcessingFilter#ACEGI_SECURITY_TARGET_URL_KEY}.
34   * </p>
35   *
36   * @author Ben Alex
37   * @version $Id: ChannelDecisionManager.java,v 1.4 2005/11/17 00:55:50 benalex Exp $
38   */
39  public interface ChannelDecisionManager {
40      //~ Methods ================================================================
41  
42      /***
43       * Decided whether the presented {@link FilterInvocation} provides the
44       * appropriate level of channel security based on the requested {@link
45       * ConfigAttributeDefinition}.
46       */
47      public void decide(FilterInvocation invocation,
48          ConfigAttributeDefinition config) throws IOException, ServletException;
49  
50      /***
51       * Indicates whether this <code>ChannelDecisionManager</code> is able to
52       * process the passed <code>ConfigAttribute</code>.
53       * 
54       * <p>
55       * This allows the <code>ChannelProcessingFilter</code> to check every
56       * configuration attribute can be consumed by the configured
57       * <code>ChannelDecisionManager</code>.
58       * </p>
59       *
60       * @param attribute a configuration attribute that has been configured
61       *        against the <code>ChannelProcessingFilter</code>
62       *
63       * @return true if this <code>ChannelDecisionManager</code> can support the
64       *         passed configuration attribute
65       */
66      public boolean supports(ConfigAttribute attribute);
67  }