01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * 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.intercept.web;
17:
18: import java.util.HashMap;
19: import java.util.Iterator;
20: import java.util.Map;
21:
22: import org.acegisecurity.ConfigAttributeDefinition;
23:
24: /**
25: * Mock for {@link FilterInvocationDefinitionMap}
26: *
27: * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
28: * @version $Id: MockFilterInvocationDefinitionSource.java 1496 2006-05-23
29: * 13:38:33Z benalex $
30: */
31: public class MockFilterInvocationDefinition implements
32: FilterInvocationDefinition {
33:
34: private Map secureUrls = new HashMap();
35:
36: private boolean convertUrlToLowercaseBeforeComparison = false;
37:
38: public void addSecureUrl(String expression,
39: ConfigAttributeDefinition attr) {
40: secureUrls.put(expression, attr);
41: }
42:
43: public boolean isConvertUrlToLowercaseBeforeComparison() {
44: return convertUrlToLowercaseBeforeComparison;
45: }
46:
47: public void setConvertUrlToLowercaseBeforeComparison(
48: boolean convertUrlToLowercaseBeforeComparison) {
49: this .convertUrlToLowercaseBeforeComparison = convertUrlToLowercaseBeforeComparison;
50: }
51:
52: public ConfigAttributeDefinition getSecureUrl(String expression) {
53: return (ConfigAttributeDefinition) secureUrls.get(expression);
54: }
55:
56: public ConfigAttributeDefinition getAttributes(Object object)
57: throws IllegalArgumentException {
58: return (ConfigAttributeDefinition) secureUrls.get(object);
59: }
60:
61: public Iterator getConfigAttributeDefinitions() {
62: return secureUrls.values().iterator();
63: }
64:
65: public boolean supports(Class clazz) {
66: return true;
67: }
68: }
|