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.ui.x509;
17:
18: import junit.framework.TestCase;
19:
20: import org.acegisecurity.BadCredentialsException;
21:
22: import org.springframework.mock.web.MockHttpServletRequest;
23: import org.springframework.mock.web.MockHttpServletResponse;
24:
25: import javax.servlet.http.HttpServletResponse;
26:
27: /**
28: * Tests {@link X509ProcessingFilterEntryPoint}.
29: *
30: * @author Luke Taylor
31: * @version $Id: X509ProcessingFilterEntryPointTests.java 1496 2006-05-23 13:38:33Z benalex $
32: */
33: public class X509ProcessingFilterEntryPointTests extends TestCase {
34: //~ Constructors ===================================================================================================
35:
36: public X509ProcessingFilterEntryPointTests() {
37: super ();
38: }
39:
40: public X509ProcessingFilterEntryPointTests(String arg0) {
41: super (arg0);
42: }
43:
44: //~ Methods ========================================================================================================
45:
46: public final void setUp() throws Exception {
47: super .setUp();
48: }
49:
50: public void testNormalOperation() throws Exception {
51: MockHttpServletRequest request = new MockHttpServletRequest();
52: MockHttpServletResponse response = new MockHttpServletResponse();
53: X509ProcessingFilterEntryPoint entryPoint = new X509ProcessingFilterEntryPoint();
54:
55: entryPoint.commence(request, response,
56: new BadCredentialsException(
57: "As thrown by security enforcement filter"));
58: assertEquals(HttpServletResponse.SC_FORBIDDEN, response
59: .getStatus());
60: }
61: }
|