Search in sources :

Example 6 with Authentication

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

the class DefaultAuthenticationHandler method setAuthentication.

/**
 * {@inheritDoc}
 */
@Override
public void setAuthentication(Authentication authentication) throws SecurityProviderNotFoundException, SecurityException, UnknownAuthenticationTypeException {
    Authentication authResult = manager.authenticate(authentication);
    if (securityContext == null) {
        securityContext = manager.createSecurityContext(authResult);
    }
    this.securityContext.setAuthentication(authResult);
    this.securityContextUpdater.accept(securityContext);
}
Also used : Authentication(org.mule.runtime.api.security.Authentication) DefaultMuleAuthentication(org.mule.runtime.api.security.DefaultMuleAuthentication)

Example 7 with Authentication

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

the class MuleEventTestCase method createTestAuthentication.

private SecurityContext createTestAuthentication() {
    Authentication auth = new DefaultMuleAuthentication(new DefaultMuleCredentials("dan", new char[] { 'd', 'f' }));
    SecurityContext securityContext = new DefaultSecurityContextFactory().create(auth.setProperties(singletonMap("key1", "value1")));
    return securityContext;
}
Also used : DefaultSecurityContextFactory(org.mule.runtime.core.internal.security.DefaultSecurityContextFactory) DefaultMuleAuthentication(org.mule.runtime.api.security.DefaultMuleAuthentication) Authentication(org.mule.runtime.api.security.Authentication) SecurityContext(org.mule.runtime.api.security.SecurityContext) DefaultMuleCredentials(org.mule.runtime.core.api.security.DefaultMuleCredentials) DefaultMuleAuthentication(org.mule.runtime.api.security.DefaultMuleAuthentication)

Aggregations

Authentication (org.mule.runtime.api.security.Authentication)7 DefaultMuleAuthentication (org.mule.runtime.api.security.DefaultMuleAuthentication)5 SecurityContext (org.mule.runtime.api.security.SecurityContext)3 UnauthorisedException (org.mule.runtime.api.security.UnauthorisedException)3 DefaultMuleCredentials (org.mule.runtime.core.api.security.DefaultMuleCredentials)3 InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)2 SecurityException (org.mule.runtime.api.security.SecurityException)2 SecurityProviderNotFoundException (org.mule.runtime.api.security.SecurityProviderNotFoundException)2 UnknownAuthenticationTypeException (org.mule.runtime.api.security.UnknownAuthenticationTypeException)2 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Test (org.junit.Test)1 TypedValue (org.mule.runtime.api.metadata.TypedValue)1 Credentials (org.mule.runtime.api.security.Credentials)1 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)1 CryptoFailureException (org.mule.runtime.core.api.security.CryptoFailureException)1 EncryptionStrategyNotFoundException (org.mule.runtime.core.api.security.EncryptionStrategyNotFoundException)1 SecurityProvider (org.mule.runtime.core.api.security.SecurityProvider)1 CredentialsNotSetException (org.mule.runtime.core.internal.security.CredentialsNotSetException)1 DefaultSecurityContextFactory (org.mule.runtime.core.internal.security.DefaultSecurityContextFactory)1