} else { try { captured = ElytronXmlParser.parseAuthenticationClientConfiguration(authConfigUri).create(); } catch (GeneralSecurityException | ConfigXMLParseException e) { throw new IOException("Failed to parse authentication configuration " + authConfig, e);
/** * Parse an Elytron authentication client configuration from a configuration discovered using the default wildfly-client-config discovery rules. * * @return the authentication context factory * @throws ConfigXMLParseException if the resource failed to be parsed */ public static SecurityFactory<AuthenticationContext> parseAuthenticationClientConfiguration() throws ConfigXMLParseException { final ClientConfiguration clientConfiguration = ClientConfiguration.getInstance(); if (clientConfiguration != null) try (final ConfigurationXMLStreamReader streamReader = clientConfiguration.readConfiguration(KNOWN_NAMESPACES.keySet())) { if (streamReader != null) { xmlLog.tracef("Parsing configuration from %s for namespace %s", streamReader.getUri(), streamReader.getNamespaceURI()); return parseAuthenticationClientConfiguration(streamReader); } else { if (xmlLog.isTraceEnabled()) { xmlLog.tracef("No configuration found for known namespaces '%s'", namespacesToString()); } } } xmlLog.trace("Fallback to parse legacy configuration."); // Try legacy configuration next return parseLegacyConfiguration(); }
/** * Parse an Elytron authentication client configuration from a resource located at a specified {@link URI}. * * @param uri the {@link URI} of the configuration. * @return the authentication context factory * @throws ConfigXMLParseException if the resource failed to be parsed */ public static SecurityFactory<AuthenticationContext> parseAuthenticationClientConfiguration(URI uri) throws ConfigXMLParseException { final ClientConfiguration clientConfiguration = ClientConfiguration.getInstance(uri); if (clientConfiguration != null) try (final ConfigurationXMLStreamReader streamReader = clientConfiguration.readConfiguration(KNOWN_NAMESPACES.keySet())) { if (streamReader != null) { xmlLog.tracef("Parsig configuration from %s for namespace %s", streamReader.getUri(), streamReader.getNamespaceURI()); return parseAuthenticationClientConfiguration(streamReader); } else { if (xmlLog.isTraceEnabled()) { xmlLog.tracef("No configuration found for known namespaces '%s'", namespacesToString()); } } } xmlLog.trace("Fallback to parse legacy configuration."); // Try legacy configuration next return parseLegacyConfiguration(); }
public ElytronClientCredentialsProvider(URI authenticationConfig) throws ConfigXMLParseException, GeneralSecurityException { context = ElytronXmlParser.parseAuthenticationClientConfiguration(authenticationConfig).create(); }
public ElytronClientCredentialsProvider(URI authenticationConfig) throws ConfigXMLParseException, GeneralSecurityException { context = ElytronXmlParser.parseAuthenticationClientConfiguration(authenticationConfig).create(); }
/** * Create a new model controller client. The client can (and should) be closed without affecting other usages. * * @param authConfigUri the path to the {@code wildfly-config.xml} to use or {@code null} * * @return the domain client */ public DomainClient createDomainClient(final URI authConfigUri) { final DomainTestConnection connection = this.connection; if(connection == null) { throw new IllegalStateException(); } if (authConfigUri == null) { return DomainClient.Factory.create(connection.createClient()); } try { final AuthenticationContext context = ElytronXmlParser.parseAuthenticationClientConfiguration(authConfigUri).create(); return DomainClient.Factory.create(new ContextualModelControllerClient(connection.createClient(), context)); } catch (GeneralSecurityException | ConfigXMLParseException e) { throw new RuntimeException("Failed to parse authentication configuration: " + authConfigUri, e); } }
/** * Get a shared domain client. * * @param authConfigUri the path to the {@code wildfly-config.xml} to use or {@code null} * * @return the domain client */ public synchronized DomainClient getDomainClient(final URI authConfigUri) { if (authConfigUri == null) { return DomainClient.Factory.create(internalGetOrCreateClient()); } try { final AuthenticationContext context = ElytronXmlParser.parseAuthenticationClientConfiguration(authConfigUri).create(); return DomainClient.Factory.create(new ContextualModelControllerClient(internalGetOrCreateClient(), context)); } catch (GeneralSecurityException | ConfigXMLParseException e) { throw new RuntimeException("Failed to parse authentication configuration: " + authConfigUri, e); } }
} else { try { captured = ElytronXmlParser.parseAuthenticationClientConfiguration(authConfigUri).create(); } catch (GeneralSecurityException | ConfigXMLParseException e) { throw new IOException("Failed to parse authentication configuration " + authConfig, e);
} else { try { captured = ElytronXmlParser.parseAuthenticationClientConfiguration(authConfigUri).create(); } catch (GeneralSecurityException | ConfigXMLParseException e) { throw new IOException("Failed to parse authentication configuration " + authConfig, e);
/** * Create a client instance based on the client configuration. * * @param configuration the controller client configuration * @return the client */ public static ModelControllerClient create(final ModelControllerClientConfiguration configuration) { final ModelControllerClient result = RemotingModelControllerClient.create(configuration); Contextual<?> contextual = null; final URI authenticationConfig = configuration.getAuthenticationConfigUri(); if (authenticationConfig != null) { try { contextual = ElytronXmlParser.parseAuthenticationClientConfiguration(authenticationConfig).create(); } catch (GeneralSecurityException | ConfigXMLParseException e) { throw ControllerClientLogger.ROOT_LOGGER.failedToParseAuthenticationConfig(e, authenticationConfig); } } if (contextual == null) { return result; } return new ContextualModelControllerClient(result, contextual); }
/** * Parse an Elytron authentication client configuration from a configuration discovered using the default wildfly-client-config discovery rules. * * @return the authentication context factory * @throws ConfigXMLParseException if the resource failed to be parsed */ public static SecurityFactory<AuthenticationContext> parseAuthenticationClientConfiguration() throws ConfigXMLParseException { final ClientConfiguration clientConfiguration = ClientConfiguration.getInstance(); if (clientConfiguration != null) try (final ConfigurationXMLStreamReader streamReader = clientConfiguration.readConfiguration(KNOWN_NAMESPACES.keySet())) { if (streamReader != null) { xmlLog.tracef("Parsing configuration from %s for namespace %s", streamReader.getUri(), streamReader.getNamespaceURI()); return parseAuthenticationClientConfiguration(streamReader); } else { if (xmlLog.isTraceEnabled()) { xmlLog.tracef("No configuration found for known namespaces '%s'", namespacesToString()); } } } xmlLog.trace("Fallback to parse legacy configuration."); // Try legacy configuration next return parseLegacyConfiguration(); }
/** * Parse an Elytron authentication client configuration from a configuration discovered using the default wildfly-client-config discovery rules. * * @return the authentication context factory * @throws ConfigXMLParseException if the resource failed to be parsed */ public static SecurityFactory<AuthenticationContext> parseAuthenticationClientConfiguration() throws ConfigXMLParseException { final ClientConfiguration clientConfiguration = ClientConfiguration.getInstance(); if (clientConfiguration != null) try (final ConfigurationXMLStreamReader streamReader = clientConfiguration.readConfiguration(KNOWN_NAMESPACES.keySet())) { if (streamReader != null) { xmlLog.tracef("Parsing configuration from %s for namespace %s", streamReader.getUri(), streamReader.getNamespaceURI()); return parseAuthenticationClientConfiguration(streamReader); } else { if (xmlLog.isTraceEnabled()) { xmlLog.tracef("No configuration found for known namespaces '%s'", namespacesToString()); } } } xmlLog.trace("Fallback to parse legacy configuration."); // Try legacy configuration next return parseLegacyConfiguration(); }
/** * Parse an Elytron authentication client configuration from a resource located at a specified {@link URI}. * * @param uri the {@link URI} of the configuration. * @return the authentication context factory * @throws ConfigXMLParseException if the resource failed to be parsed */ public static SecurityFactory<AuthenticationContext> parseAuthenticationClientConfiguration(URI uri) throws ConfigXMLParseException { final ClientConfiguration clientConfiguration = ClientConfiguration.getInstance(uri); if (clientConfiguration != null) try (final ConfigurationXMLStreamReader streamReader = clientConfiguration.readConfiguration(KNOWN_NAMESPACES.keySet())) { if (streamReader != null) { xmlLog.tracef("Parsig configuration from %s for namespace %s", streamReader.getUri(), streamReader.getNamespaceURI()); return parseAuthenticationClientConfiguration(streamReader); } else { if (xmlLog.isTraceEnabled()) { xmlLog.tracef("No configuration found for known namespaces '%s'", namespacesToString()); } } } xmlLog.trace("Fallback to parse legacy configuration."); // Try legacy configuration next return parseLegacyConfiguration(); }
/** * Parse an Elytron authentication client configuration from a resource located at a specified {@link URI}. * * @param uri the {@link URI} of the configuration. * @return the authentication context factory * @throws ConfigXMLParseException if the resource failed to be parsed */ public static SecurityFactory<AuthenticationContext> parseAuthenticationClientConfiguration(URI uri) throws ConfigXMLParseException { final ClientConfiguration clientConfiguration = ClientConfiguration.getInstance(uri); if (clientConfiguration != null) try (final ConfigurationXMLStreamReader streamReader = clientConfiguration.readConfiguration(KNOWN_NAMESPACES.keySet())) { if (streamReader != null) { xmlLog.tracef("Parsig configuration from %s for namespace %s", streamReader.getUri(), streamReader.getNamespaceURI()); return parseAuthenticationClientConfiguration(streamReader); } else { if (xmlLog.isTraceEnabled()) { xmlLog.tracef("No configuration found for known namespaces '%s'", namespacesToString()); } } } xmlLog.trace("Fallback to parse legacy configuration."); // Try legacy configuration next return parseLegacyConfiguration(); }
/** * Parse an Elytron authentication client configuration from a configuration discovered using the default wildfly-client-config discovery rules. * * @return the authentication context factory * @throws ConfigXMLParseException if the resource failed to be parsed */ public static SecurityFactory<AuthenticationContext> parseAuthenticationClientConfiguration() throws ConfigXMLParseException { final ClientConfiguration clientConfiguration = ClientConfiguration.getInstance(); if (clientConfiguration != null) try (final ConfigurationXMLStreamReader streamReader = clientConfiguration.readConfiguration(KNOWN_NAMESPACES.keySet())) { if (streamReader != null) { xmlLog.tracef("Parsing configuration from %s for namespace %s", streamReader.getUri(), streamReader.getNamespaceURI()); return parseAuthenticationClientConfiguration(streamReader); } else { if (xmlLog.isTraceEnabled()) { xmlLog.tracef("No configuration found for known namespaces '%s'", namespacesToString()); } } } xmlLog.trace("Fallback to parse legacy configuration."); // Try legacy configuration next return parseLegacyConfiguration(); }
/** * Parse an Elytron authentication client configuration from a resource located at a specified {@link URI}. * * @param uri the {@link URI} of the configuration. * @return the authentication context factory * @throws ConfigXMLParseException if the resource failed to be parsed */ public static SecurityFactory<AuthenticationContext> parseAuthenticationClientConfiguration(URI uri) throws ConfigXMLParseException { final ClientConfiguration clientConfiguration = ClientConfiguration.getInstance(uri); if (clientConfiguration != null) try (final ConfigurationXMLStreamReader streamReader = clientConfiguration.readConfiguration(KNOWN_NAMESPACES.keySet())) { if (streamReader != null) { xmlLog.tracef("Parsig configuration from %s for namespace %s", streamReader.getUri(), streamReader.getNamespaceURI()); return parseAuthenticationClientConfiguration(streamReader); } else { if (xmlLog.isTraceEnabled()) { xmlLog.tracef("No configuration found for known namespaces '%s'", namespacesToString()); } } } xmlLog.trace("Fallback to parse legacy configuration."); // Try legacy configuration next return parseLegacyConfiguration(); }