use of org.neo4j.server.security.enterprise.auth.SecureHasher in project neo4j by neo4j.
the class PluginAuthenticationInfoTest method shouldCreateCorrectAuthenticationInfoFromCacheable.
@Test
public void shouldCreateCorrectAuthenticationInfoFromCacheable() {
SecureHasher hasher = mock(SecureHasher.class);
when(hasher.hash(Matchers.any())).thenReturn(new SimpleHash("some-hash"));
PluginAuthenticationInfo internalAuthInfo = PluginAuthenticationInfo.createCacheable(CacheableAuthenticationInfo.of("thePrincipal", new byte[] { 1 }), "theRealm", hasher);
assertThat((List<String>) internalAuthInfo.getPrincipals().asList(), containsInAnyOrder("thePrincipal"));
}
use of org.neo4j.server.security.enterprise.auth.SecureHasher in project neo4j by neo4j.
the class PluginAuthenticationInfoTest method shouldCreateCorrectAuthenticationInfoFromCustomCacheable.
@Test
public void shouldCreateCorrectAuthenticationInfoFromCustomCacheable() {
SecureHasher hasher = mock(SecureHasher.class);
when(hasher.hash(Matchers.any())).thenReturn(new SimpleHash("some-hash"));
PluginAuthenticationInfo internalAuthInfo = PluginAuthenticationInfo.createCacheable(CustomCacheableAuthenticationInfo.of("thePrincipal", ignoredAuthToken -> true), "theRealm", hasher);
assertThat((List<String>) internalAuthInfo.getPrincipals().asList(), containsInAnyOrder("thePrincipal"));
}
Aggregations