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);
}
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;
}
Aggregations