Package org.wildfly.security.auth.client
Class AuthenticationContextConfigurationClient
java.lang.Object
org.wildfly.security.auth.client.AuthenticationContextConfigurationClient
A client for consuming authentication context configurations.
- Author:
- David M. Lloyd
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PrivilegedAction<AuthenticationContextConfigurationClient>A reusable privileged action to create a new configuration client. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconnect(URI uri, AuthenticationConfiguration configuration, int protocolDefaultPort) Deprecated.createSaslClient(URI uri, AuthenticationConfiguration configuration, Collection<String> offeredMechanisms) Create a SASL client using the given URI and configuration from the given SASL client factory.createSaslClient(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.createSaslClient(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.getAuthenticationConfiguration(URI uri, AuthenticationContext authenticationContext) Get the authentication configuration which matches the given URI, orAuthenticationConfiguration.EMPTYif there is none.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.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.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.getAuthorizationPrincipal(AuthenticationConfiguration configuration) Get the authorization principal to use for the given configuration.getCallbackHandler(AuthenticationConfiguration configuration) Get an authentication callback handler for the given configuration.getConfiguredSSLContexts(AuthenticationContext authenticationContext) Get all SSL contexts configured for this authentication context.getDefaultSSLContext(AuthenticationContext authenticationContext) Get the default SSL context that should be used when no other rules match, orSSLContext.getDefault()if there is none configured.getDestinationInetSocketAddress(URI uri, AuthenticationConfiguration configuration, int protocolDefaultPort) Deprecated.UseInet.getResolved(java.net.URI, int)instead.getDestinationInetSocketAddress(AuthenticationConfiguration configuration) Deprecated.This configuration is not supported by most providers and will be removed in a future release.getPrincipal(AuthenticationConfiguration configuration) Get the authentication principal to use for the given configuration.getProviderSupplier(AuthenticationConfiguration configuration) getRealHost(URI uri, AuthenticationConfiguration configuration) Deprecated.UseURI.getHost()instead.getRealHost(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.getRealProtocol(URI uri, AuthenticationConfiguration configuration) Deprecated.UseURI.getScheme()instead.getRealProtocol(AuthenticationConfiguration configuration) Deprecated.This configuration is not supported by most providers and will be removed in a future release.getSaslProtocol(AuthenticationConfiguration configuration) Get the actual sasl protocol to use for the given configuration.getSSLContext(URI uri, AuthenticationContext authenticationContext) Get the SSL context which matches the given URI, orSSLContext.getDefault()if there is none.getSSLContext(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.getSSLContext(AuthenticationContext authenticationContext) Get the configured SSL context which matches ALL rules from provided AuthenticationContext, orSSLContext.getDefault()if there is none.org.wildfly.security.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.getWsHttpMech(AuthenticationConfiguration configuration) Get the WebServices HTTP mechanism to use for the given configuration.getWsSecurityType(AuthenticationConfiguration configuration) Get the actual WS-Security type to use for the given configuration.
-
Field Details
-
ACTION
A reusable privileged action to create a new configuration client.
-
-
Constructor Details
-
AuthenticationContextConfigurationClient
Construct a new instance. Requires thecreateAuthenticationContextConfigurationClientElytronPermission.- Throws:
SecurityException- if the caller does not have permission to instantiate this class
-
-
Method Details
-
getAuthenticationConfiguration
public 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 benull)authenticationContext- the authentication context to examine (must not benull)- Returns:
- the matching configuration
-
getAuthenticationConfiguration
public 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 benull)authenticationContext- the authentication context to examine (must not benull)protocolDefaultPort- the protocol-default port- Returns:
- the matching configuration
-
getAuthenticationConfiguration
public 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 benull)authenticationContext- the authentication context to examine (must not benull)protocolDefaultPort- the protocol-default portabstractType- the abstract type (may benull)abstractTypeAuthority- the abstract type authority (may benull)- Returns:
- the matching configuration
-
getAuthenticationConfigurationNoOverrides
public 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 benull)authenticationContext- the authentication context to examine (must not benull)abstractType- the abstract type (may benull)abstractTypeAuthority- the abstract type authority (may benull)- Returns:
- the matching configuration
-
getConfiguredSSLContexts
public List<SSLContext> getConfiguredSSLContexts(AuthenticationContext authenticationContext) throws GeneralSecurityException Get all SSL contexts configured for this authentication context.- Parameters:
authenticationContext- the authentication context to examine (must not benull)- Returns:
- List of all configured SSL contexts belonging to the provided authentication context
- Throws:
GeneralSecurityException
-
getDefaultSSLContext
public SSLContext getDefaultSSLContext(AuthenticationContext authenticationContext) throws GeneralSecurityException Get the default SSL context that should be used when no other rules match, orSSLContext.getDefault()if there is none configured.- Parameters:
authenticationContext- the authentication context to examine (must not benull)- Returns:
- the default SSL context configured if no other rules match
- Throws:
GeneralSecurityException
-
getSSLContext
public SSLContext getSSLContext(AuthenticationContext authenticationContext) throws GeneralSecurityException Get the configured SSL context which matches ALL rules from provided AuthenticationContext, orSSLContext.getDefault()if there is none.- Parameters:
authenticationContext- the authentication context to examine (must not benull)- Returns:
- the SSL context from provided AuthenticationContext that matches ALL rules
- Throws:
GeneralSecurityException
-
getSSLContext
public 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 benull)authenticationContext- the authentication context to examine (must not benull)- Returns:
- the matching SSL context
- Throws:
GeneralSecurityException
-
getSSLContext
public 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 benull)authenticationContext- the authentication context to examine (must not benull)abstractType- the abstract type (may benull)abstractTypeAuthority- the abstract type authority (may benull)- Returns:
- the matching SSL context
- Throws:
GeneralSecurityException
-
getSSLContextFactory
public org.wildfly.security.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 matchauthenticationContext- the authentication context to examine (must not benull)abstractType- the abstract type (may benull)abstractTypeAuthority- the abstract type authority (may benull)- Returns:
- the matching SSL context factory (not
null)
-
getCallbackHandler
Get an authentication callback handler for the given configuration.- Parameters:
configuration- the configuration (must not benull)- Returns:
- the callback handler
-
getRealHost
Deprecated.UseURI.getHost()instead.Get the actual host to use for the given configuration and URI.- Parameters:
uri- the URI (must not benull)configuration- the configuration (must not benull)- Returns:
- the real host to use
-
getRealHost
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 benull)- Returns:
- the real host to use
-
getRealPort
Deprecated.UseURI.getPort()instead.Get the actual port to use for the given configuration and URI.- Parameters:
uri- the URI (must not benull)configuration- the configuration (must not benull)- Returns:
- the real port to use
-
getRealPort
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 benull)- Returns:
- the real port to use
-
getRealProtocol
Deprecated.UseURI.getScheme()instead.Get the actual protocol to use for the given configuration and URI.- Parameters:
uri- the URI (must not benull)configuration- the configuration (must not benull)- Returns:
- the actual protocol to use, or
nullif none is configured and none is present on the URI
-
getRealProtocol
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 benull)- Returns:
- the actual protocol to use, or
nullif none is configured
-
getSaslProtocol
Get the actual sasl protocol to use for the given configuration.- Parameters:
configuration- the configuration (must not benull)- Returns:
- the real port to use
-
getWsHttpMech
Get the WebServices HTTP mechanism to use for the given configuration.- Parameters:
configuration- the configuration (must not benull)- Returns:
- the HTTP mechanism to use
-
getWsSecurityType
Get the actual WS-Security type to use for the given configuration.- Parameters:
configuration- the configuration (must not benull)- Returns:
- the WS-Security type to use
-
getPrincipal
Get the authentication principal to use for the given configuration.- Parameters:
configuration- the configuration (must not benull)- Returns:
- the authentication principal (not
null)
-
getAuthorizationPrincipal
Get the authorization principal to use for the given configuration.- Parameters:
configuration- the configuration (must not benull)- Returns:
- the authorization principal, or
nullif none is specified
-
createSaslClient
public 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 benull)configuration- the authentication configuration (must not benull)offeredMechanisms- the available mechanisms (must not benull)- Returns:
- the SASL client, or
nullif no clients were available or could be configured - Throws:
SaslException
-
createSaslClient
public 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 benull)configuration- the authentication configuration (must not benull)offeredMechanisms- the available mechanisms (must not benull)factoryOperator- aUnaryOperatorto apply to theSaslClientFactoryused- Returns:
- the SASL client, or
nullif no clients were available or could be configured - Throws:
SaslException
-
createSaslClient
public 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 benull)configuration- the authentication configuration (must not benull)offeredMechanisms- the available mechanisms (must not benull)factoryOperator- aUnaryOperatorto apply to theSaslClientFactoryusedsslSession- the SSL session active for this connection, ornullfor 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 benull)configuration- the authentication configuration to use (must not benull)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 benull)- 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 URIconfiguration- the authentication configuration to useprotocolDefaultPort- 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
-
getProviderSupplier
- Parameters:
configuration- the authentication configuration to use (must not benull)- Returns:
- a supplier as a source for
Providerinstances (notnull)
-
Inet.getResolved(java.net.URI, int)withSocket(InetAddress, int)instead.