1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.providers;
17
18 import org.acegisecurity.Authentication;
19 import org.acegisecurity.AuthenticationException;
20
21
22 /***
23 * An {@link AuthenticationProvider} implementation for the {@link
24 * TestingAuthenticationToken}.
25 *
26 * <p>
27 * It simply accepts as valid whatever is contained within the
28 * <code>TestingAuthenticationToken</code>.
29 * </p>
30 *
31 * <p>
32 * The purpose of this implementation is to facilitate unit testing. This
33 * provider should <B>never be enabled on a production system</b>.
34 * </p>
35 *
36 * @author Ben Alex
37 * @version $Id: TestingAuthenticationProvider.java,v 1.3 2005/11/17 00:55:49 benalex Exp $
38 */
39 public class TestingAuthenticationProvider implements AuthenticationProvider {
40
41
42 public Authentication authenticate(Authentication authentication)
43 throws AuthenticationException {
44 return authentication;
45 }
46
47 public boolean supports(Class authentication) {
48 if (TestingAuthenticationToken.class.isAssignableFrom(authentication)) {
49 return true;
50 } else {
51 return false;
52 }
53 }
54 }