Search in sources :

Example 16 with AuthenticationContext

use of org.wildfly.security.auth.client.AuthenticationContext in project wildfly by wildfly.

the class SwitchIdentityTestCase method setupAuthenticationContext.

private AuthenticationContext setupAuthenticationContext(final String username) {
    OptionMap.Builder builder = OptionMap.builder().set(Options.SASL_POLICY_NOANONYMOUS, true);
    builder.set(Options.SASL_POLICY_NOPLAINTEXT, false);
    builder.set(Options.SASL_DISALLOWED_MECHANISMS, Sequence.of("JBOSS-LOCAL-USER"));
    final AuthenticationContext authenticationContext = AuthenticationContext.empty().with(MatchRule.ALL, AuthenticationConfiguration.EMPTY.useName(username == null ? "$local" : username).useRealm(null).allowSaslMechanisms("DIGEST-MD5").useMechanismProperties(getSaslProperties(builder.getMap())).useProvidersFromClassLoader(org.jboss.as.test.integration.ejb.container.interceptor.security.SwitchIdentityTestCase.class.getClassLoader()));
    return authenticationContext;
}
Also used : AuthenticationContext(org.wildfly.security.auth.client.AuthenticationContext) OptionMap(org.xnio.OptionMap)

Aggregations

AuthenticationContext (org.wildfly.security.auth.client.AuthenticationContext)16 AuthenticationConfiguration (org.wildfly.security.auth.client.AuthenticationConfiguration)7 OptionMap (org.xnio.OptionMap)4 EJBAccessException (javax.ejb.EJBAccessException)3 Context (javax.naming.Context)3 NamingException (javax.naming.NamingException)3 BeforeClass (org.junit.BeforeClass)3 Principal (java.security.Principal)2 CallbackHandler (javax.security.auth.callback.CallbackHandler)2 UnsupportedCallbackException (javax.security.auth.callback.UnsupportedCallbackException)2 EJBClientContext (org.jboss.ejb.client.EJBClientContext)2 SecurityIdentity (org.wildfly.security.auth.server.SecurityIdentity)2 XATerminator (com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator)1 TransactionManagerImple (com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple)1 TransactionSynchronizationRegistryImple (com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)1 JTAEnvironmentBean (com.arjuna.ats.jta.common.JTAEnvironmentBean)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 PrivilegedActionException (java.security.PrivilegedActionException)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1