use of org.mule.runtime.core.internal.security.DefaultMuleSecurityManager in project mule by mulesoft.
the class AbstractSecurityFilter method initialise.
@Override
public final void initialise() throws InitialisationException {
if (securityManager == null) {
securityManager = (SecurityManager) registry.lookupByName(OBJECT_SECURITY_MANAGER).get();
}
if (securityManager == null) {
throw new InitialisationException(authSecurityManagerNotSet(), this);
}
// security providers
if (securityProviders != null) {
SecurityManager localManager = new DefaultMuleSecurityManager();
String[] securityProviders = splitAndTrim(this.securityProviders, ",");
for (String sp : securityProviders) {
SecurityProvider provider = securityManager.getProvider(sp);
if (provider != null) {
localManager.addProvider(provider);
} else {
throw new InitialisationException(objectNotRegistered("Security Provider", sp), this);
}
}
securityManager = localManager;
}
doInitialise();
}
use of org.mule.runtime.core.internal.security.DefaultMuleSecurityManager in project mule by mulesoft.
the class QueueManagerLifecycleOrderTestCase method before.
@Before
public void before() throws InitialisationException, ConfigurationException {
Map<String, Object> objects = new HashMap<>();
objects.put(OBJECT_QUEUE_MANAGER, rtqm);
objects.put(OBJECT_SECURITY_MANAGER, new DefaultMuleSecurityManager());
objects.put(PROCESSOR_INTERCEPTOR_MANAGER_REGISTRY_KEY, mock(ProcessorInterceptorManager.class));
muleContext = new DefaultMuleContextFactory().createMuleContext(testServicesConfigurationBuilder, new SimpleConfigurationBuilder(objects));
testServicesConfigurationBuilder.configure(muleContext);
}
use of org.mule.runtime.core.internal.security.DefaultMuleSecurityManager in project mule by mulesoft.
the class DefaultsConfigurationBuilder method doConfigure.
@Override
protected void doConfigure(MuleContext muleContext) throws Exception {
MuleRegistry registry = ((MuleContextWithRegistries) muleContext).getRegistry();
new SimpleRegistryBootstrap(APP, muleContext).initialise();
configureQueueManager(muleContext);
registry.registerObject(OBJECT_MULE_CONTEXT, muleContext);
registerObject(OBJECT_SECURITY_MANAGER, new DefaultMuleSecurityManager(), muleContext);
registerObject(BASE_IN_MEMORY_OBJECT_STORE_KEY, createDefaultInMemoryObjectStore(), muleContext);
registerObject(BASE_PERSISTENT_OBJECT_STORE_KEY, createDefaultPersistentObjectStore(), muleContext);
registerLocalObjectStoreManager(muleContext, registry);
registerObject(OBJECT_SCHEDULER_POOLS_CONFIG, SchedulerContainerPoolsConfig.getInstance(), muleContext);
registerObject(OBJECT_SCHEDULER_BASE_CONFIG, config().withPrefix(muleContext.getConfiguration().getId()).withShutdownTimeout(() -> muleContext.getConfiguration().getShutdownTimeout(), MILLISECONDS), muleContext);
registerObject(OBJECT_STORE_MANAGER, new MuleObjectStoreManager(), muleContext);
registerObject(OBJECT_DEFAULT_MESSAGE_PROCESSING_MANAGER, new MuleMessageProcessingManager(), muleContext);
registerObject(OBJECT_MULE_STREAM_CLOSER_SERVICE, new DefaultStreamCloserService(), muleContext);
registerObject(OBJECT_LOCK_PROVIDER, new SingleServerLockProvider(), muleContext);
registerObject(OBJECT_LOCK_FACTORY, new MuleLockFactory(), muleContext);
registerObject(OBJECT_PROCESSING_TIME_WATCHER, new DefaultProcessingTimeWatcher(), muleContext);
registerObject(OBJECT_DEFAULT_RETRY_POLICY_TEMPLATE, new NoRetryPolicyTemplate(), muleContext);
registerObject(OBJECT_CONVERTER_RESOLVER, new DynamicDataTypeConversionResolver(muleContext), muleContext);
registerObject(DEFAULT_OBJECT_SERIALIZER_NAME, new JavaObjectSerializer(), muleContext);
registerObject(OBJECT_EXPRESSION_LANGUAGE, new MVELExpressionLanguage(muleContext), muleContext);
StreamingManager streamingManager = new DefaultStreamingManager();
registerObject(OBJECT_STREAMING_MANAGER, streamingManager, muleContext);
registerObject(OBJECT_EXPRESSION_MANAGER, new DefaultExpressionManager(), muleContext);
registerObject(OBJECT_TIME_SUPPLIER, new LocalTimeSupplier(), muleContext);
registerObject(OBJECT_CONNECTION_MANAGER, new DefaultConnectionManager(muleContext), muleContext);
registerObject(METADATA_SERVICE_KEY, new MuleMetadataService(), muleContext);
registerObject(VALUE_PROVIDER_SERVICE_KEY, new MuleValueProviderService(), muleContext);
registerObject(PROCESSOR_INTERCEPTOR_MANAGER_REGISTRY_KEY, new DefaultProcessorInterceptorManager(), muleContext);
registerObject(OBJECT_NOTIFICATION_DISPATCHER, new DefaultNotificationDispatcher(), muleContext);
registerObject(NotificationListenerRegistry.REGISTRY_KEY, new DefaultNotificationListenerRegistry(), muleContext);
registerObject(EventContextService.REGISTRY_KEY, new DefaultEventContextService(), muleContext);
registerObject(OBJECT_TRANSACTION_FACTORY_LOCATOR, new TransactionFactoryLocator(), muleContext);
registerObject(ComponentInitialStateManager.SERVICE_ID, new ComponentInitialStateManager() {
@Override
public boolean mustStartMessageSource(Component component) {
return true;
}
}, muleContext);
}
use of org.mule.runtime.core.internal.security.DefaultMuleSecurityManager in project mule by mulesoft.
the class DefaultAuthenticationHandler method setAuthentication.
/**
* {@inheritDoc}
*/
@Override
public void setAuthentication(List<String> securityProviders, Authentication authentication) throws SecurityProviderNotFoundException, SecurityException, UnknownAuthenticationTypeException {
if (!securityProviders.isEmpty()) {
// This filter may only allow authentication on a subset of registered
// security providers
SecurityManager localManager = new DefaultMuleSecurityManager();
for (String sp : securityProviders) {
SecurityProvider provider = manager.getProvider(sp);
if (provider != null) {
localManager.addProvider(provider);
} else {
throw new SecurityProviderNotFoundException(sp);
}
}
this.manager = localManager;
}
setAuthentication(authentication);
}
use of org.mule.runtime.core.internal.security.DefaultMuleSecurityManager in project mule by mulesoft.
the class MuleSecurityManagerConfigurator method doGetObject.
@Override
public SecurityManager doGetObject() throws Exception {
List<SecurityManager> securityManagers = new ArrayList<>();
securityManagers.add(muleContext.getSecurityManager());
SecurityManager factorySecurityManager = muleContext.getSecurityManager();
if (!name.equals(OBJECT_SECURITY_MANAGER)) {
factorySecurityManager = new DefaultMuleSecurityManager();
securityManagers.add(factorySecurityManager);
}
securityManagers.stream().forEach(securityManager -> {
providers.stream().forEach(provider -> {
securityManager.addProvider(provider);
});
encryptionStrategies.stream().forEach(encryptionStrategy -> {
securityManager.addEncryptionStrategy(encryptionStrategy);
});
});
return factorySecurityManager;
}
Aggregations