Search in sources :

Example 61 with AccessToken

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);
}
Also used : AccessToken(com.cinchapi.concourse.thrift.AccessToken) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Example 62 with AccessToken

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));
}
Also used : AccessToken(com.cinchapi.concourse.thrift.AccessToken) ByteBuffer(java.nio.ByteBuffer) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Example 63 with AccessToken

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));
}
Also used : AccessToken(com.cinchapi.concourse.thrift.AccessToken) ByteBuffer(java.nio.ByteBuffer) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Example 64 with AccessToken

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));
}
Also used : AccessToken(com.cinchapi.concourse.thrift.AccessToken) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Example 65 with AccessToken

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);
}
Also used : AccessToken(com.cinchapi.concourse.thrift.AccessToken) ByteBuffer(java.nio.ByteBuffer) ConcourseBaseTest(com.cinchapi.concourse.test.ConcourseBaseTest) Test(org.junit.Test)

Aggregations

AccessToken (com.cinchapi.concourse.thrift.AccessToken)96 ByteBuffer (java.nio.ByteBuffer)72 TransactionToken (com.cinchapi.concourse.thrift.TransactionToken)60 TException (org.apache.thrift.TException)60 AtomicReference (java.util.concurrent.atomic.AtomicReference)56 AnyStrings (com.cinchapi.common.base.AnyStrings)55 CheckedExceptions (com.cinchapi.common.base.CheckedExceptions)55 Reflection (com.cinchapi.common.reflect.Reflection)55 Permission (com.cinchapi.concourse.security.Permission)55 Role (com.cinchapi.concourse.security.Role)55 Internal (com.cinchapi.concourse.server.aop.Internal)55 VerifyAccessToken (com.cinchapi.concourse.server.aop.VerifyAccessToken)55 VerifyReadPermission (com.cinchapi.concourse.server.aop.VerifyReadPermission)55 VerifyWritePermission (com.cinchapi.concourse.server.aop.VerifyWritePermission)55 FileSystem (com.cinchapi.concourse.server.io.FileSystem)55 ConcourseManagementService (com.cinchapi.concourse.server.management.ConcourseManagementService)55 PluginManager (com.cinchapi.concourse.server.plugin.PluginManager)55 AbstractSyntaxTree (com.cinchapi.ccl.syntax.AbstractSyntaxTree)28 NaturalLanguage (com.cinchapi.ccl.util.NaturalLanguage)28 Array (com.cinchapi.common.base.Array)28