Search in sources :

Example 6 with EnterpriseSecurityContext

use of org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext in project neo4j by neo4j.

the class EnterpriseSecurityContextDescriptionTest method shouldMakeNiceDescriptionOverridden.

@Test
public void shouldMakeNiceDescriptionOverridden() throws Throwable {
    manager.newRole("role1", "mats");
    manager.addRoleToUser(PUBLISHER, "mats");
    EnterpriseSecurityContext overridden = context.withMode(new OverriddenAccessMode(context.mode(), AccessMode.Static.READ));
    assertThat(overridden.description(), equalTo("user 'mats' with roles [publisher,role1] overridden by READ"));
}
Also used : EnterpriseSecurityContext(org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext) OverriddenAccessMode(org.neo4j.kernel.impl.api.security.OverriddenAccessMode) Test(org.junit.Test)

Example 7 with EnterpriseSecurityContext

use of org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext in project neo4j by neo4j.

the class EnterpriseSecurityContextDescriptionTest method shouldMakeNiceDescriptionRestricted.

@Test
public void shouldMakeNiceDescriptionRestricted() throws Throwable {
    manager.newRole("role1", "mats");
    manager.addRoleToUser(PUBLISHER, "mats");
    EnterpriseSecurityContext restricted = context.withMode(new RestrictedAccessMode(context.mode(), AccessMode.Static.READ));
    assertThat(restricted.description(), equalTo("user 'mats' with roles [publisher,role1] restricted to READ"));
}
Also used : EnterpriseSecurityContext(org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext) RestrictedAccessMode(org.neo4j.kernel.impl.api.security.RestrictedAccessMode) Test(org.junit.Test)

Example 8 with EnterpriseSecurityContext

use of org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext in project neo4j by neo4j.

the class EnterpriseSecurityContextDescriptionTest method shouldMakeNiceDescriptionFrozen.

@Test
public void shouldMakeNiceDescriptionFrozen() throws Throwable {
    manager.newRole("role1", "mats");
    manager.addRoleToUser(PUBLISHER, "mats");
    EnterpriseSecurityContext frozen = context.freeze();
    assertThat(frozen.description(), equalTo("user 'mats' with roles [publisher,role1]"));
}
Also used : EnterpriseSecurityContext(org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext) Test(org.junit.Test)

Example 9 with EnterpriseSecurityContext

use of org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext in project neo4j by neo4j.

the class EnterpriseSecurityContextDescriptionTest method shouldMakeNiceDescriptionWithMode.

@Test
public void shouldMakeNiceDescriptionWithMode() throws Throwable {
    manager.newRole("role1", "mats");
    manager.addRoleToUser(PUBLISHER, "mats");
    EnterpriseSecurityContext modified = context.withMode(AccessMode.Static.CREDENTIALS_EXPIRED);
    assertThat(modified.description(), equalTo("user 'mats' with CREDENTIALS_EXPIRED"));
}
Also used : EnterpriseSecurityContext(org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext) Test(org.junit.Test)

Example 10 with EnterpriseSecurityContext

use of org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext in project neo4j by neo4j.

the class EnterpriseSecurityContextDescriptionTest method shouldMakeNiceDescriptionAuthDisabled.

@Test
public void shouldMakeNiceDescriptionAuthDisabled() throws Throwable {
    EnterpriseSecurityContext disabled = EnterpriseSecurityContext.AUTH_DISABLED;
    assertThat(disabled.description(), equalTo("AUTH_DISABLED with FULL"));
}
Also used : EnterpriseSecurityContext(org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext) Test(org.junit.Test)

Aggregations

EnterpriseSecurityContext (org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext)17 Test (org.junit.Test)14 Matchers.containsString (org.hamcrest.Matchers.containsString)3 InternalTransaction (org.neo4j.kernel.impl.coreapi.InternalTransaction)3 GraphDatabaseFacade (org.neo4j.kernel.impl.factory.GraphDatabaseFacade)3 Before (org.junit.Before)2 ResourceIterator (org.neo4j.graphdb.ResourceIterator)2 RestrictedAccessMode (org.neo4j.kernel.impl.api.security.RestrictedAccessMode)2 EmbeddedInteraction (org.neo4j.server.security.enterprise.auth.EmbeddedInteraction)2 AuthenticationException (org.apache.shiro.authc.AuthenticationException)1 ExcessiveAttemptsException (org.apache.shiro.authc.ExcessiveAttemptsException)1 UnsupportedTokenException (org.apache.shiro.authc.pam.UnsupportedTokenException)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 QueryExecutionException (org.neo4j.graphdb.QueryExecutionException)1 Result (org.neo4j.graphdb.Result)1 AuthProviderTimeoutException (org.neo4j.graphdb.security.AuthProviderTimeoutException)1 AuthSubject (org.neo4j.kernel.api.security.AuthSubject)1 InvalidAuthTokenException (org.neo4j.kernel.api.security.exception.InvalidAuthTokenException)1 EnterpriseAuthManager (org.neo4j.kernel.enterprise.api.security.EnterpriseAuthManager)1 OverriddenAccessMode (org.neo4j.kernel.impl.api.security.OverriddenAccessMode)1