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   * 
13   * @author Ricardo Trindade (ricardo.trindade@emation.pt)
14   */
15  public class TestAuthenticator extends DefaultAuthenticator {
16  
17      /**
18       * @see org.itracker.ejb.authentication.AbstractPluggableAuthenticator#checkLogin(java.lang.String,
19       *      java.lang.Object, int, int)
20       */
21      public User checkLogin(String login, Object authentication, int authType, int reqSource)
22              throws AuthenticatorException {
23  
24          UserService userService = getUserService();
25          return (userService.getUserByLogin("admin"));
26  
27      }
28  
29      /*
30       * (non-Javadoc)
31       * 
32       * @see org.itracker.ejb.authentication.AbstractPluggableAuthenticator#allowProfileUpdates(org.itracker.model.deprecatedmodels.User,
33       *      java.lang.Object, int, int)
34       */
35      public boolean allowProfileUpdates(User user, Object authentication, int authType, int reqSource)
36              throws AuthenticatorException {
37          return true;
38      }
39  
40      /*
41       * (non-Javadoc)
42       * 
43       * @see org.itracker.ejb.authentication.AbstractPluggableAuthenticator#allowPasswordUpdates(org.itracker.model.deprecatedmodels.User,
44       *      java.lang.Object, int, int)
45       */
46      public boolean allowPasswordUpdates(User user, Object authentication, int authType, int reqSource)
47              throws AuthenticatorException {
48          return false;
49      }
50  
51  }