View Javadoc
1   package org.itracker.services.authentication;
2   
3   import org.itracker.model.User;
4   import org.itracker.services.UserService;
5   import org.itracker.services.exceptions.AuthenticatorException;
6   
7   
8   /**
9    * An authenticator that always returns the admin user.
10   * Mainly for testing
11   *
12   * @author Ricardo Trindade (ricardo.trindade@emation.pt)
13   */
14  public class TestAuthenticator extends DefaultAuthenticator {
15  
16      /**
17       * @see org.itracker.ejb.authentication.AbstractPluggableAuthenticator#checkLogin(java.lang.String,
18       *      java.lang.Object, int, int)
19       */
20      public User checkLogin(String login, Object authentication, int authType, int reqSource)
21              throws AuthenticatorException {
22  
23          UserService userService = getUserService();
24          return (userService.getUserByLogin("admin"));
25  
26      }
27  
28      /*
29       * (non-Javadoc)
30       * 
31       * @see org.itracker.ejb.authentication.AbstractPluggableAuthenticator#allowProfileUpdates(org.itracker.model.deprecatedmodels.User,
32       *      java.lang.Object, int, int)
33       */
34      public boolean allowProfileUpdates(User user, Object authentication, int authType, int reqSource)
35              throws AuthenticatorException {
36          return true;
37      }
38  
39      /*
40       * (non-Javadoc)
41       * 
42       * @see org.itracker.ejb.authentication.AbstractPluggableAuthenticator#allowPasswordUpdates(org.itracker.model.deprecatedmodels.User,
43       *      java.lang.Object, int, int)
44       */
45      public boolean allowPasswordUpdates(User user, Object authentication, int authType, int reqSource)
46              throws AuthenticatorException {
47          return false;
48      }
49  
50  }