/Testing/RoastTestApp/src/main/java/name/aikesommer/authenticator/test/TestAuthenticator.java

http://authenticroast.googlecode.com/ · Java · 29 lines · 15 code · 6 blank · 8 comment · 1 complexity · 160920354b57b7f53ae85b9de1072793 MD5 · raw file

  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package name.aikesommer.authenticator.test;
  6. import name.aikesommer.authenticator.AuthenticationRequest;
  7. import name.aikesommer.authenticator.FormAuthenticator;
  8. import name.aikesommer.authenticator.PluggableAuthenticator.AuthenticationManager;
  9. import name.aikesommer.authenticator.SimplePrincipal;
  10. /**
  11. *
  12. * @author Aike J Sommer
  13. */
  14. public class TestAuthenticator extends FormAuthenticator {
  15. @Override
  16. protected boolean checkCredentials(AuthenticationManager manager, AuthenticationRequest request, String username, String password) {
  17. return "test".equals(username) && "test".equals(password);
  18. }
  19. @Override
  20. protected SimplePrincipal loadPrincipal(AuthenticationManager manager, AuthenticationRequest request, String username) {
  21. return new SimplePrincipal(username, "user");
  22. }
  23. }