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