Package org.geomajas.plugin.staticsecurity.command.dto

Examples of org.geomajas.plugin.staticsecurity.command.dto.LoginResponse


  @Autowired
  private AuthenticationTokenService tokenService;

  public LoginResponse getEmptyCommandResponse() {
    return new LoginResponse();
  }
View Full Code Here


  @Test
  public void testValidLogin() throws Exception {
    LoginRequest request = new LoginRequest();
    request.setLogin("luc");
    request.setPassword("luc");
    LoginResponse response = loginCommand.getEmptyCommandResponse();
    loginCommand.execute(request, response);
    String token = response.getToken();
    Assert.assertNotNull(token);

    Authentication auth = tokenService.getAuthentication(token);
    Assert.assertEquals(1, auth.getAuthorizations().length);
    BaseAuthorization authorizaton = auth.getAuthorizations()[0];
View Full Code Here

  @Test
  public void testValidLogin2() throws Exception {
    LoginRequest request = new LoginRequest();
    request.setLogin("marino");
    request.setPassword("marino");
    LoginResponse response = loginCommand.getEmptyCommandResponse();
    loginCommand.execute(request, response);
    String token = response.getToken();
    Assert.assertNotNull(token);

    Authentication auth = tokenService.getAuthentication(token);
    Assert.assertEquals(1, auth.getAuthorizations().length);
    BaseAuthorization authorizaton = auth.getAuthorizations()[0];
View Full Code Here

  @Test
  public void testInvalidLogin() throws Exception {
    LoginRequest request = new LoginRequest();
    request.setLogin("chris");
    request.setPassword("chris");
    LoginResponse response = loginCommand.getEmptyCommandResponse();
    loginCommand.execute(request, response);
    Assert.assertNull(response.getToken());

    request.setLogin("luc");
    request.setPassword("some");
    loginCommand.execute(request, response);
    Assert.assertNull(response.getToken());

    request.setLogin(null);
    request.setPassword("luc");
    loginCommand.execute(request, response);
    Assert.assertNull(response.getToken());

    request.setLogin("luc");
    request.setPassword(null);
    loginCommand.execute(request, response);
    Assert.assertNull(response.getToken());

    request.setLogin("empty");
    request.setPassword("");
    loginCommand.execute(request, response);
    Assert.assertNull(response.getToken());
  }
View Full Code Here

    command.setCommandRequest(request);
    GwtCommandDispatcher.getInstance().execute(command, new CommandCallback() {

      public void execute(CommandResponse response) {
        if (response instanceof LoginResponse) {
          LoginResponse loginResponse = (LoginResponse) response;
          if (loginResponse.getToken() == null) {
            if (callback != null) {
              callback.execute(false);
            }
            manager.fireEvent(new LoginFailureEvent(loginResponse.getErrorMessages()));
          } else {
            userToken = loginResponse.getToken();
            Authentication.this.userId = userId;
            GwtCommandDispatcher.getInstance().setUserToken(userToken);
            if (callback != null) {
              callback.execute(true);
            }
View Full Code Here

TOP

Related Classes of org.geomajas.plugin.staticsecurity.command.dto.LoginResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.