use of com.cinchapi.concourse.thrift.AccessToken in project concourse by cinchapi.
the class UserServiceTest method testServiceTokenNotTiedToUser.
@Test(expected = IllegalArgumentException.class)
public void testServiceTokenNotTiedToUser() {
AccessToken token = service.tokens.issueServiceToken();
service.getUserId(token);
}
use of com.cinchapi.concourse.thrift.AccessToken in project concourse by cinchapi.
the class UserServiceTest method testInvalidatingOneAccessTokenDoesNotAffectOther.
@Test
public void testInvalidatingOneAccessTokenDoesNotAffectOther() {
ByteBuffer username = getAcceptableUsername();
ByteBuffer password = getSecurePassword();
service.create(username, password, Role.ADMIN);
AccessToken token1 = service.tokens.issue(username);
AccessToken token2 = service.tokens.issue(username);
service.tokens.expire(token2);
Assert.assertTrue(service.tokens.isValid(token1));
}
use of com.cinchapi.concourse.thrift.AccessToken in project concourse by cinchapi.
the class UserServiceTest method testServiceTokenUsesInvalidUsername.
@Test
public void testServiceTokenUsesInvalidUsername() {
AccessToken token = service.tokens.issueServiceToken();
ByteBuffer username = service.tokens.identify(token);
Assert.assertFalse(UserService.isAcceptableUsername(username));
}
use of com.cinchapi.concourse.thrift.AccessToken in project concourse by cinchapi.
the class UserServiceTest method testServiceTokenIsValid.
@Test
public void testServiceTokenIsValid() {
AccessToken token = service.tokens.issueServiceToken();
Assert.assertTrue(service.tokens.isValid(token));
}
use of com.cinchapi.concourse.thrift.AccessToken in project concourse by cinchapi.
the class UserServiceTest method testRenabledUserCanGetToken.
@Test
public void testRenabledUserCanGetToken() {
ByteBuffer username = getAcceptableUsername();
service.create(username, getSecurePassword(), Role.USER);
service.disable(username);
service.enable(username);
AccessToken token = service.tokens.issue(username);
Assert.assertNotNull(token);
}
Aggregations