use of ddf.security.audit.impl.SecurityLoggerImpl in project ddf by codice.
the class AbstractIntegrationTest method initFacades.
@SuppressWarnings({ "squid:S2696" /* writing to static ddfHome to share state between test methods */
})
@PostTestConstruct
public void initFacades() {
RestAssured.config = RestAssuredConfig.config().xmlConfig(XmlConfig.xmlConfig().namespaceAware(false));
ddfHome = System.getProperty(DDF_HOME_PROPERTY);
adminConfig = new AdminConfig(configAdmin);
Security security = new org.codice.ddf.security.impl.Security();
((org.codice.ddf.security.impl.Security) security).setSecurityLogger(new SecurityLoggerImpl(new SubjectUtils()));
// This proxy runs the service manager as the system subject
serviceManager = (ServiceManager) Proxy.newProxyInstance(AbstractIntegrationTest.class.getClassLoader(), ServiceManagerImpl.class.getInterfaces(), new ServiceManagerProxy(new ServiceManagerImpl(metatype, adminConfig, bundleContext, bundleService, features), security));
catalogBundle = new CatalogBundle(serviceManager, adminConfig);
securityPolicy = new SecurityPolicyConfigurator(serviceManager, configAdmin);
urlResourceReaderConfigurator = new UrlResourceReaderConfigurator(configAdmin);
console = new KarafConsole(bundleContext, features, sessionFactory);
}
use of ddf.security.audit.impl.SecurityLoggerImpl in project ddf by codice.
the class SecurityPolicyConfigurator method createChecker.
private Callable<Boolean> createChecker(final Map<String, Object> policyProperties) {
final ContextPolicyManager ctxPolicyMgr = services.getService(ContextPolicyManager.class);
final PolicyManager targetPolicies = new PolicyManager();
targetPolicies.setSecurityLogger(new SecurityLoggerImpl(new SubjectUtils()));
targetPolicies.setPolicies(policyProperties);
return () -> {
for (ContextPolicy policy : ctxPolicyMgr.getAllContextPolicies()) {
ContextPolicy targetPolicy = targetPolicies.getContextPolicy(policy.getContextPath());
if (targetPolicy == null || !targetPolicy.getContextPath().equals(policy.getContextPath()) || !targetPolicy.getAuthenticationMethods().containsAll(policy.getAuthenticationMethods()) || !targetPolicy.getAllowedAttributeNames().containsAll(policy.getAllowedAttributeNames())) {
return false;
}
}
return true;
};
}
Aggregations