Package org.wildfly.security.auth.client
Class AuthenticationContextConfigurationClient
- java.lang.Object
- 
- org.wildfly.security.auth.client.AuthenticationContextConfigurationClient
 
- 
 public final class AuthenticationContextConfigurationClient extends Object A client for consuming authentication context configurations.- Author:
- David M. Lloyd
 
- 
- 
Field SummaryFields Modifier and Type Field Description static PrivilegedAction<AuthenticationContextConfigurationClient>ACTIONA reusable privileged action to create a new configuration client.
 - 
Constructor SummaryConstructors Constructor Description AuthenticationContextConfigurationClient()Construct a new instance.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Socketconnect(URI uri, AuthenticationConfiguration configuration, int protocolDefaultPort)Deprecated.UseInet.getResolved(java.net.URI, int)withSocket(InetAddress, int)instead.SaslClientcreateSaslClient(URI uri, AuthenticationConfiguration configuration, Collection<String> offeredMechanisms)Create a SASL client using the given URI and configuration from the given SASL client factory.SaslClientcreateSaslClient(URI uri, AuthenticationConfiguration configuration, Collection<String> offeredMechanisms, UnaryOperator<SaslClientFactory> factoryOperator)Create a SASL client using the given URI and configuration from the given SASL client factory.SaslClientcreateSaslClient(URI uri, AuthenticationConfiguration configuration, Collection<String> offeredMechanisms, UnaryOperator<SaslClientFactory> factoryOperator, SSLSession sslSession)Create a SASL client using the given URI and configuration from the given SASL client factory.AuthenticationConfigurationgetAuthenticationConfiguration(URI uri, AuthenticationContext authenticationContext)Get the authentication configuration which matches the given URI, orAuthenticationConfiguration.EMPTYif there is none.AuthenticationConfigurationgetAuthenticationConfiguration(URI uri, AuthenticationContext authenticationContext, int protocolDefaultPort)Get the authentication configuration which matches the given URI, orAuthenticationConfiguration.EMPTYif there is none, setting a default protocol port.AuthenticationConfigurationgetAuthenticationConfiguration(URI uri, AuthenticationContext authenticationContext, int protocolDefaultPort, String abstractType, String abstractTypeAuthority)Get the authentication configuration which matches the given URI and type, orAuthenticationConfiguration.EMPTYif there is none, setting a default protocol port.AuthenticationConfigurationgetAuthenticationConfigurationNoOverrides(URI uri, AuthenticationContext authenticationContext, String abstractType, String abstractTypeAuthority)Get the authentication configuration which matches the given URI and type, orAuthenticationConfiguration.EMPTYif there is none.PrincipalgetAuthorizationPrincipal(AuthenticationConfiguration configuration)Get the authorization principal to use for the given configuration.CallbackHandlergetCallbackHandler(AuthenticationConfiguration configuration)Get an authentication callback handler for the given configuration.InetSocketAddressgetDestinationInetSocketAddress(URI uri, AuthenticationConfiguration configuration, int protocolDefaultPort)Deprecated.UseInet.getResolved(java.net.URI, int)instead.InetSocketAddressgetDestinationInetSocketAddress(AuthenticationConfiguration configuration)Deprecated.This configuration is not supported by most providers and will be removed in a future release.PrincipalgetPrincipal(AuthenticationConfiguration configuration)Get the authentication principal to use for the given configuration.Supplier<Provider[]>getProviderSupplier(AuthenticationConfiguration configuration)StringgetRealHost(URI uri, AuthenticationConfiguration configuration)Deprecated.UseURI.getHost()instead.StringgetRealHost(AuthenticationConfiguration configuration)Deprecated.This configuration is not supported by most providers and will be removed in a future release.intgetRealPort(URI uri, AuthenticationConfiguration configuration)Deprecated.UseURI.getPort()instead.intgetRealPort(AuthenticationConfiguration configuration)Deprecated.This configuration is not supported by most providers and will be removed in a future release.StringgetRealProtocol(URI uri, AuthenticationConfiguration configuration)Deprecated.UseURI.getScheme()instead.StringgetRealProtocol(AuthenticationConfiguration configuration)Deprecated.This configuration is not supported by most providers and will be removed in a future release.StringgetSaslProtocol(AuthenticationConfiguration configuration)Get the actual sasl protocol to use for the given configuration.SSLContextgetSSLContext(URI uri, AuthenticationContext authenticationContext)Get the SSL context which matches the given URI, orSSLContext.getDefault()if there is none.SSLContextgetSSLContext(URI uri, AuthenticationContext authenticationContext, String abstractType, String abstractTypeAuthority)Get the SSL context which matches the given URI and type, orSSLContext.getDefault()if there is none.SecurityFactory<SSLContext>getSSLContextFactory(URI uri, AuthenticationContext authenticationContext, String abstractType, String abstractTypeAuthority)Get the SSL context factory which matches the given URI and type, orSSLContext.getDefault()if there is none.StringgetWsHttpMech(AuthenticationConfiguration configuration)Get the WebServices HTTP mechanism to use for the given configuration.StringgetWsSecurityType(AuthenticationConfiguration configuration)Get the actual WS-Security type to use for the given configuration.
 
- 
- 
- 
Field Detail- 
ACTIONpublic static final PrivilegedAction<AuthenticationContextConfigurationClient> ACTION A reusable privileged action to create a new configuration client.
 
- 
 - 
Constructor Detail- 
AuthenticationContextConfigurationClientpublic AuthenticationContextConfigurationClient() throws SecurityExceptionConstruct a new instance. Requires thecreateAuthenticationContextConfigurationClientElytronPermission.- Throws:
- SecurityException- if the caller does not have permission to instantiate this class
 
 
- 
 - 
Method Detail- 
getAuthenticationConfigurationpublic AuthenticationConfiguration getAuthenticationConfiguration(URI uri, AuthenticationContext authenticationContext) Get the authentication configuration which matches the given URI, orAuthenticationConfiguration.EMPTYif there is none.- Parameters:
- uri- the URI to match (must not be- null)
- authenticationContext- the authentication context to examine (must not be- null)
- Returns:
- the matching configuration
 
 - 
getAuthenticationConfigurationpublic AuthenticationConfiguration getAuthenticationConfiguration(URI uri, AuthenticationContext authenticationContext, int protocolDefaultPort) Get the authentication configuration which matches the given URI, orAuthenticationConfiguration.EMPTYif there is none, setting a default protocol port.- Parameters:
- uri- the URI to match (must not be- null)
- authenticationContext- the authentication context to examine (must not be- null)
- protocolDefaultPort- the protocol-default port
- Returns:
- the matching configuration
 
 - 
getAuthenticationConfigurationpublic AuthenticationConfiguration getAuthenticationConfiguration(URI uri, AuthenticationContext authenticationContext, int protocolDefaultPort, String abstractType, String abstractTypeAuthority) Get the authentication configuration which matches the given URI and type, orAuthenticationConfiguration.EMPTYif there is none, setting a default protocol port. The user name, host, port, and protocol from the URI are copied into the configuration when the configuration does not already establish values for those fields.- Parameters:
- uri- the URI to match (must not be- null)
- authenticationContext- the authentication context to examine (must not be- null)
- protocolDefaultPort- the protocol-default port
- abstractType- the abstract type (may be- null)
- abstractTypeAuthority- the abstract type authority (may be- null)
- Returns:
- the matching configuration
 
 - 
getAuthenticationConfigurationNoOverridespublic AuthenticationConfiguration getAuthenticationConfigurationNoOverrides(URI uri, AuthenticationContext authenticationContext, String abstractType, String abstractTypeAuthority) Get the authentication configuration which matches the given URI and type, orAuthenticationConfiguration.EMPTYif there is none. The user name from the URI is copied into the configuration if the configuration does not already establish a value for that field. No host, port, or protocol information is copied to the resultant configuration from the URI.- Parameters:
- uri- the URI to match (must not be- null)
- authenticationContext- the authentication context to examine (must not be- null)
- abstractType- the abstract type (may be- null)
- abstractTypeAuthority- the abstract type authority (may be- null)
- Returns:
- the matching configuration
 
 - 
getSSLContextpublic SSLContext getSSLContext(URI uri, AuthenticationContext authenticationContext) throws GeneralSecurityException Get the SSL context which matches the given URI, orSSLContext.getDefault()if there is none.- Parameters:
- uri- the URI to match (must not be- null)
- authenticationContext- the authentication context to examine (must not be- null)
- Returns:
- the matching SSL context
- Throws:
- GeneralSecurityException
 
 - 
getSSLContextpublic SSLContext getSSLContext(URI uri, AuthenticationContext authenticationContext, String abstractType, String abstractTypeAuthority) throws GeneralSecurityException Get the SSL context which matches the given URI and type, orSSLContext.getDefault()if there is none.- Parameters:
- uri- the URI to match (must not be- null)
- authenticationContext- the authentication context to examine (must not be- null)
- abstractType- the abstract type (may be- null)
- abstractTypeAuthority- the abstract type authority (may be- null)
- Returns:
- the matching SSL context
- Throws:
- GeneralSecurityException
 
 - 
getSSLContextFactorypublic SecurityFactory<SSLContext> getSSLContextFactory(URI uri, AuthenticationContext authenticationContext, String abstractType, String abstractTypeAuthority) Get the SSL context factory which matches the given URI and type, orSSLContext.getDefault()if there is none.- Parameters:
- uri- the URI to match (must not be- null)
- authenticationContext- the authentication context to examine (must not be- null)
- abstractType- the abstract type (may be- null)
- abstractTypeAuthority- the abstract type authority (may be- null)
- Returns:
- the matching SSL context factory (not null)
 
 - 
getCallbackHandlerpublic CallbackHandler getCallbackHandler(AuthenticationConfiguration configuration) Get an authentication callback handler for the given configuration.- Parameters:
- configuration- the configuration (must not be- null)
- Returns:
- the callback handler
 
 - 
getRealHost@Deprecated public String getRealHost(URI uri, AuthenticationConfiguration configuration) Deprecated.UseURI.getHost()instead.Get the actual host to use for the given configuration and URI.- Parameters:
- uri- the URI (must not be- null)
- configuration- the configuration (must not be- null)
- Returns:
- the real host to use
 
 - 
getRealHost@Deprecated public String getRealHost(AuthenticationConfiguration configuration) Deprecated.This configuration is not supported by most providers and will be removed in a future release.Get the actual host to use for the given configuration.- Parameters:
- configuration- the configuration (must not be- null)
- Returns:
- the real host to use
 
 - 
getRealPort@Deprecated public int getRealPort(URI uri, AuthenticationConfiguration configuration) Deprecated.UseURI.getPort()instead.Get the actual port to use for the given configuration and URI.- Parameters:
- uri- the URI (must not be- null)
- configuration- the configuration (must not be- null)
- Returns:
- the real port to use
 
 - 
getRealPort@Deprecated public int getRealPort(AuthenticationConfiguration configuration) Deprecated.This configuration is not supported by most providers and will be removed in a future release.Get the actual port to use for the given configuration.- Parameters:
- configuration- the configuration (must not be- null)
- Returns:
- the real port to use
 
 - 
getRealProtocol@Deprecated public String getRealProtocol(URI uri, AuthenticationConfiguration configuration) Deprecated.UseURI.getScheme()instead.Get the actual protocol to use for the given configuration and URI.- Parameters:
- uri- the URI (must not be- null)
- configuration- the configuration (must not be- null)
- Returns:
- the actual protocol to use, or nullif none is configured and none is present on the URI
 
 - 
getRealProtocol@Deprecated public String getRealProtocol(AuthenticationConfiguration configuration) Deprecated.This configuration is not supported by most providers and will be removed in a future release.Get the actual protocol to use for the given configuration.- Parameters:
- configuration- the configuration (must not be- null)
- Returns:
- the actual protocol to use, or nullif none is configured
 
 - 
getSaslProtocolpublic String getSaslProtocol(AuthenticationConfiguration configuration) Get the actual sasl protocol to use for the given configuration.- Parameters:
- configuration- the configuration (must not be- null)
- Returns:
- the real port to use
 
 - 
getWsHttpMechpublic String getWsHttpMech(AuthenticationConfiguration configuration) Get the WebServices HTTP mechanism to use for the given configuration.- Parameters:
- configuration- the configuration (must not be- null)
- Returns:
- the HTTP mechanism to use
 
 - 
getWsSecurityTypepublic String getWsSecurityType(AuthenticationConfiguration configuration) Get the actual WS-Security type to use for the given configuration.- Parameters:
- configuration- the configuration (must not be- null)
- Returns:
- the WS-Security type to use
 
 - 
getPrincipalpublic Principal getPrincipal(AuthenticationConfiguration configuration) Get the authentication principal to use for the given configuration.- Parameters:
- configuration- the configuration (must not be- null)
- Returns:
- the authentication principal (not null)
 
 - 
getAuthorizationPrincipalpublic Principal getAuthorizationPrincipal(AuthenticationConfiguration configuration) Get the authorization principal to use for the given configuration.- Parameters:
- configuration- the configuration (must not be- null)
- Returns:
- the authorization principal, or nullif none is specified
 
 - 
createSaslClientpublic SaslClient createSaslClient(URI uri, AuthenticationConfiguration configuration, Collection<String> offeredMechanisms) throws SaslException Create a SASL client using the given URI and configuration from the given SASL client factory.- Parameters:
- uri- the target URI (must not be- null)
- configuration- the authentication configuration (must not be- null)
- offeredMechanisms- the available mechanisms (must not be- null)
- Returns:
- the SASL client, or nullif no clients were available or could be configured
- Throws:
- SaslException
 
 - 
createSaslClientpublic SaslClient createSaslClient(URI uri, AuthenticationConfiguration configuration, Collection<String> offeredMechanisms, UnaryOperator<SaslClientFactory> factoryOperator) throws SaslException Create a SASL client using the given URI and configuration from the given SASL client factory.- Parameters:
- uri- the target URI (must not be- null)
- configuration- the authentication configuration (must not be- null)
- offeredMechanisms- the available mechanisms (must not be- null)
- factoryOperator- a- UnaryOperatorto apply to the- SaslClientFactoryused
- Returns:
- the SASL client, or nullif no clients were available or could be configured
- Throws:
- SaslException
 
 - 
createSaslClientpublic SaslClient createSaslClient(URI uri, AuthenticationConfiguration configuration, Collection<String> offeredMechanisms, UnaryOperator<SaslClientFactory> factoryOperator, SSLSession sslSession) throws SaslException Create a SASL client using the given URI and configuration from the given SASL client factory.- Parameters:
- uri- the target URI (must not be- null)
- configuration- the authentication configuration (must not be- null)
- offeredMechanisms- the available mechanisms (must not be- null)
- factoryOperator- a- UnaryOperatorto apply to the- SaslClientFactoryused
- sslSession- the SSL session active for this connection, or- nullfor none
- Returns:
- the SASL client, or nullif no clients were available or could be configured
- Throws:
- SaslException
 
 - 
getDestinationInetSocketAddress@Deprecated public InetSocketAddress getDestinationInetSocketAddress(URI uri, AuthenticationConfiguration configuration, int protocolDefaultPort) Deprecated.UseInet.getResolved(java.net.URI, int)instead.Get the address of the destination from a configuration and URI. The configuration may rewrite the destination as needed.- Parameters:
- uri- the connection URI (must not be- null)
- configuration- the authentication configuration to use (must not be- null)
- protocolDefaultPort- the default port for the protocol
- Returns:
- the address of the destination
 
 - 
getDestinationInetSocketAddress@Deprecated public InetSocketAddress getDestinationInetSocketAddress(AuthenticationConfiguration configuration) Deprecated.This configuration is not supported by most providers and will be removed in a future release.Get the address of the destination from a configuration. The configuration may rewrite the destination as needed.- Parameters:
- configuration- the authentication configuration to use (must not be- null)
- Returns:
- the address of the destination
 
 - 
connect@Deprecated public Socket connect(URI uri, AuthenticationConfiguration configuration, int protocolDefaultPort) throws IOException Deprecated.UseInet.getResolved(java.net.URI, int)withSocket(InetAddress, int)instead.Connect a plain socket to the given URI.- Parameters:
- uri- the connection URI
- configuration- the authentication configuration to use
- protocolDefaultPort- the default port for the protocol used in the URI
- Returns:
- the connected socket
- Throws:
- IOException- if socket creation or connection fails for some reason
 
 - 
getProviderSupplierpublic Supplier<Provider[]> getProviderSupplier(AuthenticationConfiguration configuration) - Parameters:
- configuration- the authentication configuration to use (must not be- null)
- Returns:
- a supplier as a source for Providerinstances (notnull)
 
 
- 
 
-