use of org.apache.jackrabbit.oak.spi.security.authentication.token.TokenInfo in project jackrabbit-oak by apache.
the class TokenProviderImplReadOnlyTest method generateToken.
private String generateToken() throws Exception {
TokenInfo info = tokenProvider.createToken(getTestUser().getID(), ImmutableMap.<String, Object>of());
String token = info.getToken();
readOnlyRoot.refresh();
return token;
}
use of org.apache.jackrabbit.oak.spi.security.authentication.token.TokenInfo in project jackrabbit-oak by apache.
the class TokenProviderImplReadOnlyTest method testRemoveToken.
@Test
public void testRemoveToken() throws Exception {
TokenInfo readOnlyInfo = readOnlyTp.getTokenInfo(generateToken());
assertFalse(readOnlyInfo.remove());
}
use of org.apache.jackrabbit.oak.spi.security.authentication.token.TokenInfo in project jackrabbit-oak by apache.
the class TokenProviderImplReadOnlyTest method testGetTokenInfo.
@Test
public void testGetTokenInfo() throws Exception {
TokenInfo readOnlyInfo = readOnlyTp.getTokenInfo(generateToken());
assertNotNull(readOnlyInfo);
}
use of org.apache.jackrabbit.oak.spi.security.authentication.token.TokenInfo in project jackrabbit-oak by apache.
the class TokenProviderImplTest method testTokenNodeName.
@Test
public void testTokenNodeName() throws Exception {
TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap());
Tree tokenTree = getTokenTree(info);
// creation which is not expected here.
try {
UUID.fromString(tokenTree.getName());
fail("UUID-name should only be used in case of conflict");
} catch (IllegalArgumentException e) {
// success
}
}
use of org.apache.jackrabbit.oak.spi.security.authentication.token.TokenInfo in project jackrabbit-oak by apache.
the class TokenAuthenticationTest method testGetTokenInfoAfterAuthenticate.
@Test
public void testGetTokenInfoAfterAuthenticate() throws Exception {
TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap());
authentication.authenticate(new TokenCredentials(info.getToken()));
TokenInfo info2 = authentication.getTokenInfo();
assertNotNull(info2);
assertEquals(info.getUserId(), info2.getUserId());
}
Aggregations