/** * Construct a new instance. * * @param delegate the delegate SASL client */ public AuthenticationContextSaslClient(final SaslClient delegate) { super(delegate); context = AuthenticationContext.captureCurrent(); }
/** * Construct a new instance. * * @param delegate the delegate SASL client factory */ public AuthenticationContextSaslClientFactory(final SaslClientFactory delegate) { super(delegate); context = AuthenticationContext.captureCurrent(); }
/** * Construct a new instance. * * @param delegate the delegate SASL server factory */ public AuthenticationContextSaslServerFactory(final SaslServerFactory delegate) { super(delegate); context = AuthenticationContext.captureCurrent(); }
/** * Construct a new instance. * * @param delegate the delegate SASL server */ public AuthenticationContextSaslServer(final SaslServer delegate) { super(delegate); context = AuthenticationContext.captureCurrent(); }
public AuthenticationContext getAuthenticationContext() { return authenticationContext == null ? AuthenticationContext.captureCurrent() : authenticationContext; } }
private AuthenticationContext getAuthenticationContext() { return authenticationContext == null ? AuthenticationContext.captureCurrent() : authenticationContext; } }
public AuthenticationContext get() { return AuthenticationContext.captureCurrent(); } };
public AuthenticationContext get() { return AuthenticationContext.captureCurrent(); } }
/** * Get a possibly shared, possibly existing connection to the destination. The authentication and SSL configuration is selected from * the currently active authentication context with the given abstract type (if specified). * * @param destination the destination URI (must not be {@code null}) * @param abstractType the abstract type of the connection (may be {@code null}) * @param abstractTypeAuthority the authority name of the abstract type of the connection (may be {@code null}) * @return the future connection identity (not {@code null}) */ default IoFuture<ConnectionPeerIdentity> getConnectedIdentity(URI destination, String abstractType, String abstractTypeAuthority) { return getConnectedIdentity(destination, abstractType, abstractTypeAuthority, AuthenticationContext.captureCurrent()); }
/** * Get a {@code UserTransaction} that controls a remote transactions state at the given {@code location}. The transaction * context may cache these instances by location. * * @return the {@code UserTransaction} (not {@code null}) */ public RemoteUserTransaction getUserTransaction() { return new RemoteUserTransaction(AuthenticationContext.captureCurrent()); }
public AuthenticationContext get() { return inherit ? context.with(AuthenticationContext.captureCurrent()) : context; } }
public IoFuture<Connection> connect(final URI destination, final OptionMap connectOptions) { return connect(destination, connectOptions, AuthenticationContext.captureCurrent()); }
@Override public SSLContext get() { AuthenticationContextConfigurationClient contextConfigurationClient = AccessController.doPrivileged(AuthenticationContextConfigurationClient.ACTION); try { return contextConfigurationClient.getSSLContext(tokenEndpointUrl.toURI(), AuthenticationContext.captureCurrent()); } catch (Exception cause) { throw saslOAuth2.failedToObtainSSLContext(cause); } } };
void init() { if (eagerlyAcquireAffinity) { acquireAffinitiy(AUTH_CONTEXT_CLIENT.getAuthenticationConfiguration(uri, AuthenticationContext.captureCurrent())); } }
Object readResolve() { AuthenticationContext context = AuthenticationContext.captureCurrent(); final NamingProvider currentNamingProvider = NamingProvider.getCurrentNamingProvider(); if (currentNamingProvider != null) { final ProviderEnvironment providerEnvironment = currentNamingProvider.getProviderEnvironment(); context = providerEnvironment.getAuthenticationContextSupplier().get(); } return context.runFunction(RemoteTransactionContext::getUserTransaction, RemoteTransactionContext.getInstancePrivate()); } }
private void acquireSessionAffinity(CountDownLatch latch, AuthenticationConfiguration authenticationConfiguration) { ClientRequest clientRequest = new ClientRequest(); clientRequest.setMethod(Methods.GET); clientRequest.setPath(uri.getPath() + "/common/v1/affinity"); AuthenticationContext context = AuthenticationContext.captureCurrent(); SSLContext sslContext; try { sslContext = AUTH_CONTEXT_CLIENT.getSSLContext(uri, context); } catch (GeneralSecurityException e) { latch.countDown(); HttpClientMessages.MESSAGES.failedToAcquireSession(e); return; } sendRequest(clientRequest, sslContext, authenticationConfiguration, null, null, (e) -> { latch.countDown(); HttpClientMessages.MESSAGES.failedToAcquireSession(e); }, null, latch::countDown); }
static <T> T createSessionProxy(final StatelessEJBLocator<T> statelessLocator, Supplier<AuthenticationContext> authenticationContextSupplier, NamingProvider namingProvider) throws Exception { final EJBClientContext clientContext = EJBClientContext.getCurrent(); // this is the auth context to use just for the invocation final AuthenticationContext authenticationContext; if (authenticationContextSupplier != null) { authenticationContext = authenticationContextSupplier.get(); } else { authenticationContext = AuthenticationContext.captureCurrent(); } final EJBSessionCreationInvocationContext context = clientContext.createSessionCreationInvocationContext(statelessLocator, authenticationContext); final StatefulEJBLocator<T> statefulLocator = clientContext.createSession(context, statelessLocator, namingProvider); final T proxy = createProxy(statefulLocator, authenticationContextSupplier); final Affinity weakAffinity = context.getWeakAffinity(); if (weakAffinity != null && Affinity.NONE != weakAffinity) { setWeakAffinity(proxy, weakAffinity); } return proxy; }
EJBClientInvocationContext(final EJBInvocationHandler<?> invocationHandler, final EJBClientContext ejbClientContext, final Object invokedProxy, final Object[] parameters, final EJBProxyInformation.ProxyMethodInfo methodInfo, final int allowedRetries, final Supplier<AuthenticationContext> authenticationContextSupplier) { super(invocationHandler.getLocator(), ejbClientContext); this.invocationHandler = invocationHandler; authenticationContext = authenticationContextSupplier != null ? authenticationContextSupplier.get() : AuthenticationContext.captureCurrent(); this.invokedProxy = invokedProxy; this.parameters = parameters; this.methodInfo = methodInfo; long timeout = invocationHandler.getInvocationTimeout(); if (timeout == -1) { timeout = ejbClientContext.getInvocationTimeout(); } this.timeout = timeout; remainingRetries = allowedRetries; interceptorList = getClientContext().getInterceptors(getViewClass(), getInvokedMethod()); }
/** * See JBEAP-14783 */ @Deprecated public IoFuture<Connection> connect(URI destination, OptionMap connectOptions, CallbackHandler callbackHandler) throws IOException { final AuthenticationContextConfigurationClient client = AUTH_CONFIGURATION_CLIENT; AuthenticationContext authenticationContext = AuthenticationContext.captureCurrent(); AuthenticationConfiguration connectionConfiguration = client .getAuthenticationConfiguration(destination, authenticationContext).useCallbackHandler(callbackHandler); connectionConfiguration = RemotingOptions.mergeOptionsIntoAuthenticationConfiguration(connectOptions, connectionConfiguration); final SSLContext sslContext; try { sslContext = client.getSSLContext(destination, authenticationContext); } catch (GeneralSecurityException e) { return new FailedIoFuture<>(Messages.conn.failedToConfigureSslContext(e)); } return connect(destination, null, connectOptions, sslContext, connectionConfiguration); }
protected boolean isConnected(final URI uri) { final IoFuture<ConnectionPeerIdentity> future = Endpoint.getCurrent().getConnectedIdentityIfExists(uri, "ejb", "jboss", AuthenticationContext.captureCurrent()); try { return future != null && future.getStatus() == IoFuture.Status.DONE && future.get().getConnection().isOpen(); } catch (IOException e) { // impossible throw Assert.unreachableCode(); } }