use of org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext in project neo4j by neo4j.
the class LdapCachingTest method shouldInvalidateAuthorizationCacheAfterTTL.
@Test
public void shouldInvalidateAuthorizationCacheAfterTTL() throws InvalidAuthTokenException {
// Given
EnterpriseSecurityContext mike = authManager.login(authToken("mike", "123"));
mike.mode().allowsReads();
assertThat("Test realm did not receive a call", testRealm.takeAuthorizationFlag(), is(true));
// When
fakeTicker.advance(99, TimeUnit.MILLISECONDS);
mike.mode().allowsWrites();
// Then
assertThat("Test realm received a call", testRealm.takeAuthorizationFlag(), is(false));
// When
fakeTicker.advance(2, TimeUnit.MILLISECONDS);
mike.mode().allowsWrites();
// Then
assertThat("Test realm did not received a call", testRealm.takeAuthorizationFlag(), is(true));
}
use of org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext in project neo4j by neo4j.
the class UserManagementProceduresLoggingTest method setUp.
@Before
public void setUp() throws Throwable {
log = new AssertableLogProvider();
SecurityLog securityLog = new SecurityLog(log.getLog(getClass()));
authProcedures = new TestUserManagementProcedures();
authProcedures.graph = mock(GraphDatabaseAPI.class);
authProcedures.securityLog = securityLog;
generalUserManager = getUserManager();
EnterpriseSecurityContext adminContext = new TestSecurityContext("admin", true, generalUserManager);
matsContext = new TestSecurityContext("mats", false, generalUserManager);
setSubject(adminContext);
}
Aggregations