Search in sources :

Example 6 with SecurityContext

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

the class PetstoreSecurityContextTestCase method filteredProviders.

@Test
public void filteredProviders() throws Exception {
    SecurityContext context = flowRunner("setSecureCageFilterProviders").withVariable("providers", asList(MOCK_PROVIDER)).run().getSecurityContext();
    assertThat(context, is(notNullValue()));
    assertThat(context, is(securityContext));
}
Also used : SecurityContext(org.mule.runtime.api.security.SecurityContext) Test(org.junit.Test)

Example 7 with SecurityContext

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

the class PetstoreSecurityContextTestCase method changedSecurityContext.

@Test
public void changedSecurityContext() throws Exception {
    SecurityContext context = flowRunner("setSecureCage").run().getSecurityContext();
    assertThat(context, is(notNullValue()));
    assertThat(context, is(securityContext));
}
Also used : SecurityContext(org.mule.runtime.api.security.SecurityContext) Test(org.junit.Test)

Example 8 with SecurityContext

use of org.mule.runtime.api.security.SecurityContext 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

SecurityContext (org.mule.runtime.api.security.SecurityContext)8 Test (org.junit.Test)4 Authentication (org.mule.runtime.api.security.Authentication)3 DefaultMuleAuthentication (org.mule.runtime.api.security.DefaultMuleAuthentication)3 SecurityProviderNotFoundException (org.mule.runtime.api.security.SecurityProviderNotFoundException)2 UnauthorisedException (org.mule.runtime.api.security.UnauthorisedException)2 DefaultMuleCredentials (org.mule.runtime.core.api.security.DefaultMuleCredentials)2 InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)1 Credentials (org.mule.runtime.api.security.Credentials)1 SecurityException (org.mule.runtime.api.security.SecurityException)1 UnknownAuthenticationTypeException (org.mule.runtime.api.security.UnknownAuthenticationTypeException)1 CryptoFailureException (org.mule.runtime.core.api.security.CryptoFailureException)1 EncryptionStrategyNotFoundException (org.mule.runtime.core.api.security.EncryptionStrategyNotFoundException)1 CredentialsNotSetException (org.mule.runtime.core.internal.security.CredentialsNotSetException)1 DefaultSecurityContextFactory (org.mule.runtime.core.internal.security.DefaultSecurityContextFactory)1