/** * Find a provider service which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider service, or {@code null} if none is found */ public static Provider.Service findProviderService(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProviderService(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }
/** * Find the first provider from the supplier which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, String serviceType, String algorithm) { final Provider.Service service = findProviderService(providerSupplier, providerName, serviceType, algorithm); return service == null ? null : service.getProvider(); }
/** * Find the first provider from the supplier which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, String serviceType, String algorithm) { final Provider.Service service = findProviderService(providerSupplier, providerName, serviceType, algorithm); return service == null ? null : service.getProvider(); }
/** * Find the first provider from the supplier which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, String serviceType, String algorithm) { final Provider.Service service = findProviderService(providerSupplier, providerName, serviceType, algorithm); return service == null ? null : service.getProvider(); }
/** * Find a provider service which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider service, or {@code null} if none is found */ public static Provider.Service findProviderService(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProviderService(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }
/** * Find the first provider from the supplier which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, String serviceType, String algorithm) { final Provider.Service service = findProviderService(providerSupplier, providerName, serviceType, algorithm); return service == null ? null : service.getProvider(); }
/** * Find a provider service which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider service, or {@code null} if none is found */ public static Provider.Service findProviderService(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProviderService(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }
/** * Find a provider service which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider service, or {@code null} if none is found */ public static Provider.Service findProviderService(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProviderService(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }
@Override protected ValueSupplier<HttpServerAuthenticationMechanismFactory> getValueSupplier( ServiceBuilder<HttpServerAuthenticationMechanismFactory> serviceBuilder, OperationContext context, ModelNode model) throws OperationFailedException { String providers = PROVIDERS.resolveModelAttribute(context, model).asStringOrNull(); final Supplier<Provider[]> providerSupplier; if (providers != null) { final InjectedValue<Provider[]> providersInjector = new InjectedValue<Provider[]>(); serviceBuilder.addDependency(context.getCapabilityServiceName( buildDynamicCapabilityName(PROVIDERS_CAPABILITY, providers), Provider[].class), Provider[].class, providersInjector); providerSupplier = providersInjector::getValue; } else { providerSupplier = Security::getProviders; } Predicate<Provider.Service> serviceFilter = (Provider.Service s) -> HttpServerAuthenticationMechanismFactory.class.getSimpleName().equals(s.getType()); return () -> { if ( findProviderService(providerSupplier, serviceFilter) == null ) { throw ROOT_LOGGER.noSuitableProvider(HttpServerAuthenticationMechanismFactory.class.getSimpleName()); } return new SetMechanismInformationMechanismFactory(new SecurityProviderServerMechanismFactory(providerSupplier)); }; }