use of org.apache.accumulo.core.securityImpl.thrift.TAuthenticationTokenIdentifier in project accumulo by apache.
the class AuthenticationTokenIdentifierTest method testExtendedEquality.
@Test
public void testExtendedEquality() {
String principal = "user";
var token = new AuthenticationTokenIdentifier(new TAuthenticationTokenIdentifier(principal));
assertEquals(token, token);
var newToken = new AuthenticationTokenIdentifier(createTAuthIdentifier(principal, 1, 5L, 10L, "uuid"));
assertNotEquals(token, newToken);
assertNotEquals(token.hashCode(), newToken.hashCode());
var dblNewToken = new AuthenticationTokenIdentifier(new TAuthenticationTokenIdentifier(principal));
dblNewToken.setKeyId(1);
dblNewToken.setIssueDate(5L);
dblNewToken.setExpirationDate(10L);
dblNewToken.setInstanceId(InstanceId.of("uuid"));
}
use of org.apache.accumulo.core.securityImpl.thrift.TAuthenticationTokenIdentifier in project accumulo by apache.
the class AuthenticationTokenIdentifierTest method testToString.
@Test
public void testToString() {
String principal = "my_special_principal";
var token = new AuthenticationTokenIdentifier(new TAuthenticationTokenIdentifier(principal));
assertTrue(token.toString().contains(principal));
}
use of org.apache.accumulo.core.securityImpl.thrift.TAuthenticationTokenIdentifier in project accumulo by apache.
the class AuthenticationTokenIdentifierTest method testUgi.
@Test
public void testUgi() {
String principal = "user";
var token = new AuthenticationTokenIdentifier(new TAuthenticationTokenIdentifier(principal));
UserGroupInformation actual = token.getUser();
UserGroupInformation expected = UserGroupInformation.createRemoteUser(principal);
assertEquals(expected.getAuthenticationMethod(), actual.getAuthenticationMethod());
assertEquals(expected.getUserName(), expected.getUserName());
}
use of org.apache.accumulo.core.securityImpl.thrift.TAuthenticationTokenIdentifier in project accumulo by apache.
the class AuthenticationTokenIdentifierTest method testEquality.
@Test
public void testEquality() {
String principal = "user";
var token = new AuthenticationTokenIdentifier(new TAuthenticationTokenIdentifier(principal));
assertEquals(token, token);
var newToken = new AuthenticationTokenIdentifier(new TAuthenticationTokenIdentifier(principal));
assertEquals(token, newToken);
assertEquals(token.hashCode(), newToken.hashCode());
}
use of org.apache.accumulo.core.securityImpl.thrift.TAuthenticationTokenIdentifier in project accumulo by apache.
the class ThriftMessageUtilTest method testSerializationAsByteArray.
@Test
public void testSerializationAsByteArray() throws IOException {
ByteBuffer buff = util.serialize(msg);
TAuthenticationTokenIdentifier copy = new TAuthenticationTokenIdentifier();
byte[] array = new byte[buff.limit()];
System.arraycopy(buff.array(), 0, array, 0, buff.limit());
util.deserialize(array, copy);
assertEquals(msg, copy);
}
Aggregations