Search in sources :

Example 1 with OperationAuthoriser

use of uk.gov.gchq.gaffer.graph.hook.OperationAuthoriser in project Gaffer by gchq.

the class GraphFactoryTest method shouldReturnNullWhenCreateOpAuthoriserWithNoSystemPropertyPath.

@Test
public void shouldReturnNullWhenCreateOpAuthoriserWithNoSystemPropertyPath() {
    // Given
    System.clearProperty(SystemProperty.OP_AUTHS_PATH);
    final GraphFactory factory = new DefaultGraphFactory();
    // When
    final OperationAuthoriser opAuthoriser = factory.createOpAuthoriser();
    // Then
    assertNull(opAuthoriser);
}
Also used : OperationAuthoriser(uk.gov.gchq.gaffer.graph.hook.OperationAuthoriser) Test(org.junit.Test) GraphFactoryForTest(uk.gov.gchq.gaffer.rest.GraphFactoryForTest)

Example 2 with OperationAuthoriser

use of uk.gov.gchq.gaffer.graph.hook.OperationAuthoriser in project Gaffer by gchq.

the class DefaultGraphFactory method createOpAuthoriser.

public OperationAuthoriser createOpAuthoriser() {
    OperationAuthoriser opAuthoriser = null;
    final String opAuthsPathStr = System.getProperty(SystemProperty.OP_AUTHS_PATH);
    if (null != opAuthsPathStr) {
        final Path opAuthsPath = Paths.get(System.getProperty(SystemProperty.OP_AUTHS_PATH));
        if (opAuthsPath.toFile().exists()) {
            opAuthoriser = new OperationAuthoriser(opAuthsPath);
        } else {
            throw new IllegalArgumentException("Could not find operation authorisation properties from path: " + opAuthsPathStr);
        }
    }
    return opAuthoriser;
}
Also used : Path(java.nio.file.Path) OperationAuthoriser(uk.gov.gchq.gaffer.graph.hook.OperationAuthoriser)

Aggregations

OperationAuthoriser (uk.gov.gchq.gaffer.graph.hook.OperationAuthoriser)2 Path (java.nio.file.Path)1 Test (org.junit.Test)1 GraphFactoryForTest (uk.gov.gchq.gaffer.rest.GraphFactoryForTest)1