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 meets a specific security condition.
29   * 
30   * <P>
31   * <code>ChannelProcessor</code> implementations are iterated by the {@link
32   * ChannelDecisionManagerImpl}.
33   * </p>
34   * 
35   * <P>
36   * If an implementation has an issue with the channel security, they should
37   * take action themselves. The callers of the implementation do not take any
38   * action.
39   * </p>
40   *
41   * @author Ben Alex
42   * @version $Id: ChannelProcessor.java,v 1.2 2005/11/17 00:55:50 benalex Exp $
43   */
44  public interface ChannelProcessor {
45      //~ Methods ================================================================
46  
47      /***
48       * Decided whether the presented {@link FilterInvocation} provides the
49       * appropriate level of channel security based on the requested {@link
50       * ConfigAttributeDefinition}.
51       */
52      public void decide(FilterInvocation invocation,
53          ConfigAttributeDefinition config) throws IOException, ServletException;
54  
55      /***
56       * Indicates whether this <code>ChannelProcessor</code> is able to process
57       * the passed <code>ConfigAttribute</code>.
58       * 
59       * <p>
60       * This allows the <code>ChannelProcessingFilter</code> to check every
61       * configuration attribute can be consumed by the configured
62       * <code>ChannelDecisionManager</code>.
63       * </p>
64       *
65       * @param attribute a configuration attribute that has been configured
66       *        against the <code>ChannelProcessingFilter</code>
67       *
68       * @return true if this <code>ChannelProcessor</code> can support the
69       *         passed configuration attribute
70       */
71      public boolean supports(ConfigAttribute attribute);
72  }