Search in sources :

Example 1 with SecurityManager

use of org.mule.runtime.core.api.security.SecurityManager 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);
}
Also used : DefaultMuleSecurityManager(org.mule.runtime.core.internal.security.DefaultMuleSecurityManager) DefaultMuleSecurityManager(org.mule.runtime.core.internal.security.DefaultMuleSecurityManager) SecurityManager(org.mule.runtime.core.api.security.SecurityManager) SecurityProviderNotFoundException(org.mule.runtime.api.security.SecurityProviderNotFoundException) SecurityProvider(org.mule.runtime.core.api.security.SecurityProvider)

Example 2 with SecurityManager

use of org.mule.runtime.core.api.security.SecurityManager in project mule by mulesoft.

the class MuleContextLifecycleTestCase method buildStartedMuleContext.

private MuleContext buildStartedMuleContext() throws Exception {
    ctx.initialise();
    // DefaultMuleContext refuses to start without these objects in place
    SecurityManager securityManager = mock(SecurityManager.class);
    ((MuleContextWithRegistries) ctx).getRegistry().registerObject(UUID.getUUID(), securityManager);
    QueueManager queueManager = mock(QueueManager.class);
    ((MuleContextWithRegistries) ctx).getRegistry().registerObject(UUID.getUUID(), queueManager);
    ctx.start();
    return ctx;
}
Also used : SecurityManager(org.mule.runtime.core.api.security.SecurityManager) QueueManager(org.mule.runtime.core.api.util.queue.QueueManager)

Aggregations

SecurityManager (org.mule.runtime.core.api.security.SecurityManager)2 SecurityProviderNotFoundException (org.mule.runtime.api.security.SecurityProviderNotFoundException)1 SecurityProvider (org.mule.runtime.core.api.security.SecurityProvider)1 QueueManager (org.mule.runtime.core.api.util.queue.QueueManager)1 DefaultMuleSecurityManager (org.mule.runtime.core.internal.security.DefaultMuleSecurityManager)1