コード例 #1
0
  @Test
  public void testCanValidateBadToken() {
    parameters.setToken(receivedBadToken);
    TokenValidatorResponse response = validator.validateToken(parameters);

    assertEquals(ReceivedToken.STATE.INVALID, response.getToken().getState());
  }
コード例 #2
0
  @Test
  public void testCanValidateBadIpToken() {
    TokenValidatorParameters params = new TokenValidatorParameters();
    params.setToken(receivedTokenBadIp);
    TokenValidatorResponse response = validator.validateToken(params);

    assertEquals(ReceivedToken.STATE.INVALID, response.getToken().getState());
  }
コード例 #3
0
  @Test
  public void testCanValidateToken() {
    TokenValidatorResponse response = validator.validateToken(parameters);

    assertEquals(ReceivedToken.STATE.VALID, response.getToken().getState());

    assertThat(response.getToken().getPrincipal(), instanceOf(GuestPrincipal.class));
  }