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

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


  @Autowired
  private AuthenticationTokenService tokenService;

  @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);
View Full Code Here


    Assert.assertTrue(authorizaton.isLayerDeleteAuthorized("bla"));
  }

  @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);
View Full Code Here

    Assert.assertFalse(authorizaton.isLayerDeleteAuthorized("bla"));
  }

  @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

  // Private methods:
  // -------------------------------------------------------------------------

  /** Effectively log in a certain user. */
  private void loginUser(final String userId, final String password, final BooleanCallback callback) {
    LoginRequest request = new LoginRequest();
    request.setLogin(userId);
    request.setPassword(password);
    GwtCommand command = new GwtCommand(loginCommandName);
    command.setCommandRequest(request);
    GwtCommandDispatcher.getInstance().execute(command, new CommandCallback() {

      public void execute(CommandResponse response) {
View Full Code Here

    securityManager.clearSecurityContext();
  }

  // assure we are logged in as a specific user to set correct authorizations
  public void login(String name) {
    LoginRequest request = new LoginRequest();
    request.setLogin(name);
    request.setPassword(name);
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof LoginResponse);
    securityManager.createSecurityContext(((LoginResponse)response).getToken());
  }
View Full Code Here

    securityManager.clearSecurityContext();
  }

  // assure we are logged in as a specific user to set correct authorizations
  public void login(String name) {
    LoginRequest request = new LoginRequest();
    request.setLogin(name);
    request.setPassword(name);
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof LoginResponse);
    securityManager.createSecurityContext(((LoginResponse)response).getToken());
  }
View Full Code Here

  @Autowired
  private SecurityContext securityContext;

  @Test
  public void testLogAllowed() throws Exception {
    LoginRequest request = new LoginRequest();
    request.setLogin("luc");
    request.setPassword("luc");
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, null);
    Assert.assertTrue(response instanceof LoginResponse);
    Assert.assertFalse(response.isError());
    String token = ((LoginResponse)response).getToken();
    Assert.assertNotNull(token);
View Full Code Here

    Assert.assertNull(securityContext.getToken());
  }

  @Test
  public void testLogNotAllowed() throws Exception {
    LoginRequest request = new LoginRequest();
    request.setLogin("marino");
    request.setPassword("marino");
    CommandResponse response = commandDispatcher.execute(LoginRequest.COMMAND, request, null, null);
    Assert.assertTrue(response instanceof LoginResponse);
    Assert.assertFalse(response.isError());
    String token = ((LoginResponse)response).getToken();
    Assert.assertNotNull(token);
View Full Code Here

    securityManager.clearSecurityContext();
  }

  // assure we are logged in as a specific user to set correct authorizations
  public void login(String name) {
    LoginRequest request = new LoginRequest();
    request.setLogin(name);
    request.setPassword(name);
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof LoginResponse);
    securityManager.createSecurityContext(((LoginResponse)response).getToken());
  }
View Full Code Here

    securityManager.clearSecurityContext();
  }

  // assure we are logged in as a specific user to set correct authorizations
  public void login(String name) {
    LoginRequest request = new LoginRequest();
    request.setLogin(name);
    request.setPassword(name);
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof LoginResponse);
    securityManager.createSecurityContext(((LoginResponse)response).getToken());
  }
View Full Code Here

TOP

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

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.