This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 050c091 CAMEL-14780 camel-undertow: UndertowSecurityProvider SPI API misses a method to change HttpHandler (#3677) 050c091 is described below commit 050c0913aaedfe8279f41b96df618545dccbf4d7 Author: JiriOndrusek <ondrusek.j...@gmail.com> AuthorDate: Wed Mar 25 14:12:30 2020 +0100 CAMEL-14780 camel-undertow: UndertowSecurityProvider SPI API misses a method to change HttpHandler (#3677) --- .../apache/camel/component/elytron/elytron.json | 2 + .../src/main/docs/elytron-component.adoc | 6 +- .../camel/component/elytron/ElytronComponent.java | 2 +- .../undertow/UndertowComponentConfigurer.java | 5 ++ .../undertow/UndertowEndpointConfigurer.java | 5 ++ .../apache/camel/component/undertow/undertow.json | 2 + .../src/main/docs/undertow-component.adoc | 6 +- .../component/undertow/UndertowComponent.java | 61 ++++++++++++++- .../camel/component/undertow/UndertowConsumer.java | 7 +- .../camel/component/undertow/UndertowEndpoint.java | 21 ++++-- .../undertow/spi/UndertowSecurityProvider.java | 11 +++ .../undertow/spi/AbstractSecurityProviderTest.java | 22 +++++- ...t.java => SecurityProviderHttpHandlerTest.java} | 32 +++----- ...=> SecurityProviderRolesFromComponentTest.java} | 29 ++++++- .../undertow/spi/SecurityProviderTest.java | 3 +- .../dsl/ElytronComponentBuilderFactory.java | 16 ++++ .../dsl/UndertowComponentBuilderFactory.java | 16 ++++ .../dsl/ElytronEndpointBuilderFactory.java | 88 ++++++++++++++++++++++ .../dsl/UndertowEndpointBuilderFactory.java | 88 ++++++++++++++++++++++ 19 files changed, 380 insertions(+), 42 deletions(-) diff --git a/components/camel-elytron/src/generated/resources/org/apache/camel/component/elytron/elytron.json b/components/camel-elytron/src/generated/resources/org/apache/camel/component/elytron/elytron.json index 76201e4..d264cb6 100644 --- a/components/camel-elytron/src/generated/resources/org/apache/camel/component/elytron/elytron.json +++ b/components/camel-elytron/src/generated/resources/org/apache/camel/component/elytron/elytron.json @@ -31,6 +31,7 @@ "undertowHttpBinding": { "kind": "property", "displayName": "Undertow Http Binding", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.undertow.UndertowHttpBinding", "deprecated": false, "secret": false, "description": "To use a custom HttpBinding to control the mapping between Camel message and HttpClient." }, "allowedRoles": { "kind": "property", "displayName": "Allowed Roles", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Configuration used by UndertowSecurityProvider. Comma separated list of allowed roles." }, "securityConfiguration": { "kind": "property", "displayName": "Security Configuration", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "secret": false, "description": "Configuration used by UndertowSecurityProvider. Security configuration object for use from UndertowSecurityProvider. Configuration is UndertowSecurityProvider specific. Each provider decides, whether it accepts configuration." }, + "securityProvider": { "kind": "property", "displayName": "Security Provider", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.component.undertow.spi.UndertowSecurityProvider", "deprecated": false, "secret": false, "description": "Security provider allows plug in the provider, which will be used to secure requests. SPI approach could be used too (component then finds security provider using SPI)." }, "sslContextParameters": { "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "secret": false, "description": "To configure security using SSLContextParameters" }, "useGlobalSslContextParameters": { "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "description": "Enable usage of global SSL context parameters." } }, @@ -62,6 +63,7 @@ "undertowHttpBinding": { "kind": "parameter", "displayName": "Undertow Http Binding", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.undertow.UndertowHttpBinding", "deprecated": false, "secret": false, "description": "To use a custom UndertowHttpBinding to control the mapping between Camel message and undertow." }, "allowedRoles": { "kind": "parameter", "displayName": "Allowed Roles", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "List of allowed roles in String format" }, "securityConfiguration": { "kind": "parameter", "displayName": "Security Configuration", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "secret": false, "description": "OConfiguration used by UndertowSecurityProvider. Security configuration object for use from UndertowSecurityProvider. Configuration is UndertowSecurityProvider specific. Each provider decides whether accepts configuration." }, + "securityProvider": { "kind": "parameter", "displayName": "Security Provider", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.component.undertow.spi.UndertowSecurityProvider", "deprecated": false, "secret": false, "description": "Security provider allows plug in the provider, which will be used to secure requests. SPI approach could be used too (endpoint then finds security provider using SPI)." }, "sslContextParameters": { "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "secret": false, "description": "To configure security using SSLContextParameters" }, "fireWebSocketChannelEvents": { "kind": "parameter", "displayName": "Fire Web Socket Channel Events", "group": "websocket", "label": "consumer,websocket", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "description": "if true, the consumer will post notifications to the route when a new WebSocket peer connects, disconnects, etc. See UndertowConstants.EVENT_TYPE and EventType." }, "sendTimeout": { "kind": "parameter", "displayName": "Send Timeout", "group": "websocket", "label": "producer,websocket", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "defaultValue": "30000", "description": "Timeout in milliseconds when sending to a websocket channel. The default timeout is 30000 (30 seconds)." }, diff --git a/components/camel-elytron/src/main/docs/elytron-component.adoc b/components/camel-elytron/src/main/docs/elytron-component.adoc index 85bc671..8178d52 100644 --- a/components/camel-elytron/src/main/docs/elytron-component.adoc +++ b/components/camel-elytron/src/main/docs/elytron-component.adoc @@ -49,7 +49,7 @@ You can append query options to the URI in the following format, == Options // component options: START -The Elytron component supports 13 options, which are listed below. +The Elytron component supports 14 options, which are listed below. @@ -67,6 +67,7 @@ The Elytron component supports 13 options, which are listed below. | *undertowHttpBinding* (advanced) | To use a custom HttpBinding to control the mapping between Camel message and HttpClient. | | UndertowHttpBinding | *allowedRoles* (security) | Configuration used by UndertowSecurityProvider. Comma separated list of allowed roles. | | String | *securityConfiguration* (security) | Configuration used by UndertowSecurityProvider. Security configuration object for use from UndertowSecurityProvider. Configuration is UndertowSecurityProvider specific. Each provider decides, whether it accepts configuration. | | Object +| *securityProvider* (security) | Security provider allows plug in the provider, which will be used to secure requests. SPI approach could be used too (component then finds security provider using SPI). | | UndertowSecurityProvider | *sslContextParameters* (security) | To configure security using SSLContextParameters | | SSLContextParameters | *useGlobalSslContextParameters* (security) | Enable usage of global SSL context parameters. | false | boolean |=== @@ -92,7 +93,7 @@ with the following path and query parameters: |=== -=== Query Parameters (30 parameters): +=== Query Parameters (31 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -124,6 +125,7 @@ with the following path and query parameters: | *undertowHttpBinding* (advanced) | To use a custom UndertowHttpBinding to control the mapping between Camel message and undertow. | | UndertowHttpBinding | *allowedRoles* (security) | List of allowed roles in String format | | String | *securityConfiguration* (security) | OConfiguration used by UndertowSecurityProvider. Security configuration object for use from UndertowSecurityProvider. Configuration is UndertowSecurityProvider specific. Each provider decides whether accepts configuration. | | Object +| *securityProvider* (security) | Security provider allows plug in the provider, which will be used to secure requests. SPI approach could be used too (endpoint then finds security provider using SPI). | | UndertowSecurityProvider | *sslContextParameters* (security) | To configure security using SSLContextParameters | | SSLContextParameters | *fireWebSocketChannelEvents* (websocket) | if true, the consumer will post notifications to the route when a new WebSocket peer connects, disconnects, etc. See UndertowConstants.EVENT_TYPE and EventType. | false | boolean | *sendTimeout* (websocket) | Timeout in milliseconds when sending to a websocket channel. The default timeout is 30000 (30 seconds). | 30000 | Integer diff --git a/components/camel-elytron/src/main/java/org/apache/camel/component/elytron/ElytronComponent.java b/components/camel-elytron/src/main/java/org/apache/camel/component/elytron/ElytronComponent.java index a62b61d..ff3fc3d 100644 --- a/components/camel-elytron/src/main/java/org/apache/camel/component/elytron/ElytronComponent.java +++ b/components/camel-elytron/src/main/java/org/apache/camel/component/elytron/ElytronComponent.java @@ -92,7 +92,7 @@ public class ElytronComponent extends UndertowComponent { } @Override - public HttpHandler registerEndpoint(UndertowConsumer consumer, HttpHandlerRegistrationInfo registrationInfo, SSLContext sslContext, HttpHandler handler) { + public HttpHandler registerEndpoint(UndertowConsumer consumer, HttpHandlerRegistrationInfo registrationInfo, SSLContext sslContext, HttpHandler handler) throws Exception { //injecting elytron return super.registerEndpoint(consumer, registrationInfo, sslContext, wrap(handler, getSecurityDomain())); } diff --git a/components/camel-undertow/src/generated/java/org/apache/camel/component/undertow/UndertowComponentConfigurer.java b/components/camel-undertow/src/generated/java/org/apache/camel/component/undertow/UndertowComponentConfigurer.java index 6ef80b8..92710d7 100644 --- a/components/camel-undertow/src/generated/java/org/apache/camel/component/undertow/UndertowComponentConfigurer.java +++ b/components/camel-undertow/src/generated/java/org/apache/camel/component/undertow/UndertowComponentConfigurer.java @@ -33,6 +33,8 @@ public class UndertowComponentConfigurer extends PropertyConfigurerSupport imple case "muteException": target.setMuteException(property(camelContext, boolean.class, value)); return true; case "securityconfiguration": case "securityConfiguration": target.setSecurityConfiguration(property(camelContext, java.lang.Object.class, value)); return true; + case "securityprovider": + case "securityProvider": target.setSecurityProvider(property(camelContext, org.apache.camel.component.undertow.spi.UndertowSecurityProvider.class, value)); return true; case "sslcontextparameters": case "sslContextParameters": target.setSslContextParameters(property(camelContext, org.apache.camel.support.jsse.SSLContextParameters.class, value)); return true; case "undertowhttpbinding": @@ -53,6 +55,7 @@ public class UndertowComponentConfigurer extends PropertyConfigurerSupport imple answer.put("lazyStartProducer", boolean.class); answer.put("muteException", boolean.class); answer.put("securityConfiguration", java.lang.Object.class); + answer.put("securityProvider", org.apache.camel.component.undertow.spi.UndertowSecurityProvider.class); answer.put("sslContextParameters", org.apache.camel.support.jsse.SSLContextParameters.class); answer.put("undertowHttpBinding", org.apache.camel.component.undertow.UndertowHttpBinding.class); answer.put("useGlobalSslContextParameters", boolean.class); @@ -77,6 +80,8 @@ public class UndertowComponentConfigurer extends PropertyConfigurerSupport imple case "muteException": return target.isMuteException(); case "securityconfiguration": case "securityConfiguration": return target.getSecurityConfiguration(); + case "securityprovider": + case "securityProvider": return target.getSecurityProvider(); case "sslcontextparameters": case "sslContextParameters": return target.getSslContextParameters(); case "undertowhttpbinding": diff --git a/components/camel-undertow/src/generated/java/org/apache/camel/component/undertow/UndertowEndpointConfigurer.java b/components/camel-undertow/src/generated/java/org/apache/camel/component/undertow/UndertowEndpointConfigurer.java index ee68028..a0aac59 100644 --- a/components/camel-undertow/src/generated/java/org/apache/camel/component/undertow/UndertowEndpointConfigurer.java +++ b/components/camel-undertow/src/generated/java/org/apache/camel/component/undertow/UndertowEndpointConfigurer.java @@ -59,6 +59,8 @@ public class UndertowEndpointConfigurer extends PropertyConfigurerSupport implem case "reuseAddresses": target.setReuseAddresses(property(camelContext, java.lang.Boolean.class, value)); return true; case "securityconfiguration": case "securityConfiguration": target.setSecurityConfiguration(property(camelContext, java.lang.Object.class, value)); return true; + case "securityprovider": + case "securityProvider": target.setSecurityProvider(property(camelContext, org.apache.camel.component.undertow.spi.UndertowSecurityProvider.class, value)); return true; case "sendtimeout": case "sendTimeout": target.setSendTimeout(property(camelContext, java.lang.Integer.class, value)); return true; case "sendtoall": @@ -104,6 +106,7 @@ public class UndertowEndpointConfigurer extends PropertyConfigurerSupport implem answer.put("preserveHostHeader", boolean.class); answer.put("reuseAddresses", java.lang.Boolean.class); answer.put("securityConfiguration", java.lang.Object.class); + answer.put("securityProvider", org.apache.camel.component.undertow.spi.UndertowSecurityProvider.class); answer.put("sendTimeout", java.lang.Integer.class); answer.put("sendToAll", java.lang.Boolean.class); answer.put("sslContextParameters", org.apache.camel.support.jsse.SSLContextParameters.class); @@ -160,6 +163,8 @@ public class UndertowEndpointConfigurer extends PropertyConfigurerSupport implem case "reuseAddresses": return target.getReuseAddresses(); case "securityconfiguration": case "securityConfiguration": return target.getSecurityConfiguration(); + case "securityprovider": + case "securityProvider": return target.getSecurityProvider(); case "sendtimeout": case "sendTimeout": return target.getSendTimeout(); case "sendtoall": diff --git a/components/camel-undertow/src/generated/resources/org/apache/camel/component/undertow/undertow.json b/components/camel-undertow/src/generated/resources/org/apache/camel/component/undertow/undertow.json index d1c30aa..86733a0 100644 --- a/components/camel-undertow/src/generated/resources/org/apache/camel/component/undertow/undertow.json +++ b/components/camel-undertow/src/generated/resources/org/apache/camel/component/undertow/undertow.json @@ -28,6 +28,7 @@ "undertowHttpBinding": { "kind": "property", "displayName": "Undertow Http Binding", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.undertow.UndertowHttpBinding", "deprecated": false, "secret": false, "description": "To use a custom HttpBinding to control the mapping between Camel message and HttpClient." }, "allowedRoles": { "kind": "property", "displayName": "Allowed Roles", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Configuration used by UndertowSecurityProvider. Comma separated list of allowed roles." }, "securityConfiguration": { "kind": "property", "displayName": "Security Configuration", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "secret": false, "description": "Configuration used by UndertowSecurityProvider. Security configuration object for use from UndertowSecurityProvider. Configuration is UndertowSecurityProvider specific. Each provider decides, whether it accepts configuration." }, + "securityProvider": { "kind": "property", "displayName": "Security Provider", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.component.undertow.spi.UndertowSecurityProvider", "deprecated": false, "secret": false, "description": "Security provider allows plug in the provider, which will be used to secure requests. SPI approach could be used too (component then finds security provider using SPI)." }, "sslContextParameters": { "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "secret": false, "description": "To configure security using SSLContextParameters" }, "useGlobalSslContextParameters": { "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "description": "Enable usage of global SSL context parameters." } }, @@ -59,6 +60,7 @@ "undertowHttpBinding": { "kind": "parameter", "displayName": "Undertow Http Binding", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.undertow.UndertowHttpBinding", "deprecated": false, "secret": false, "description": "To use a custom UndertowHttpBinding to control the mapping between Camel message and undertow." }, "allowedRoles": { "kind": "parameter", "displayName": "Allowed Roles", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Configuration used by UndertowSecurityProvider. Comma separated list of allowed roles." }, "securityConfiguration": { "kind": "parameter", "displayName": "Security Configuration", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "secret": false, "description": "OConfiguration used by UndertowSecurityProvider. Security configuration object for use from UndertowSecurityProvider. Configuration is UndertowSecurityProvider specific. Each provider decides whether accepts configuration." }, + "securityProvider": { "kind": "parameter", "displayName": "Security Provider", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.component.undertow.spi.UndertowSecurityProvider", "deprecated": false, "secret": false, "description": "Security provider allows plug in the provider, which will be used to secure requests. SPI approach could be used too (endpoint then finds security provider using SPI)." }, "sslContextParameters": { "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "secret": false, "description": "To configure security using SSLContextParameters" }, "fireWebSocketChannelEvents": { "kind": "parameter", "displayName": "Fire Web Socket Channel Events", "group": "websocket", "label": "consumer,websocket", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "description": "if true, the consumer will post notifications to the route when a new WebSocket peer connects, disconnects, etc. See UndertowConstants.EVENT_TYPE and EventType." }, "sendTimeout": { "kind": "parameter", "displayName": "Send Timeout", "group": "websocket", "label": "producer,websocket", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "defaultValue": "30000", "description": "Timeout in milliseconds when sending to a websocket channel. The default timeout is 30000 (30 seconds)." }, diff --git a/components/camel-undertow/src/main/docs/undertow-component.adoc b/components/camel-undertow/src/main/docs/undertow-component.adoc index 0348679..68628e0 100644 --- a/components/camel-undertow/src/main/docs/undertow-component.adoc +++ b/components/camel-undertow/src/main/docs/undertow-component.adoc @@ -47,7 +47,7 @@ You can append query options to the URI in the following format, == Options // component options: START -The Undertow component supports 10 options, which are listed below. +The Undertow component supports 11 options, which are listed below. @@ -62,6 +62,7 @@ The Undertow component supports 10 options, which are listed below. | *undertowHttpBinding* (advanced) | To use a custom HttpBinding to control the mapping between Camel message and HttpClient. | | UndertowHttpBinding | *allowedRoles* (security) | Configuration used by UndertowSecurityProvider. Comma separated list of allowed roles. | | String | *securityConfiguration* (security) | Configuration used by UndertowSecurityProvider. Security configuration object for use from UndertowSecurityProvider. Configuration is UndertowSecurityProvider specific. Each provider decides, whether it accepts configuration. | | Object +| *securityProvider* (security) | Security provider allows plug in the provider, which will be used to secure requests. SPI approach could be used too (component then finds security provider using SPI). | | UndertowSecurityProvider | *sslContextParameters* (security) | To configure security using SSLContextParameters | | SSLContextParameters | *useGlobalSslContextParameters* (security) | Enable usage of global SSL context parameters. | false | boolean |=== @@ -87,7 +88,7 @@ with the following path and query parameters: |=== -=== Query Parameters (30 parameters): +=== Query Parameters (31 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -119,6 +120,7 @@ with the following path and query parameters: | *undertowHttpBinding* (advanced) | To use a custom UndertowHttpBinding to control the mapping between Camel message and undertow. | | UndertowHttpBinding | *allowedRoles* (security) | Configuration used by UndertowSecurityProvider. Comma separated list of allowed roles. | | String | *securityConfiguration* (security) | OConfiguration used by UndertowSecurityProvider. Security configuration object for use from UndertowSecurityProvider. Configuration is UndertowSecurityProvider specific. Each provider decides whether accepts configuration. | | Object +| *securityProvider* (security) | Security provider allows plug in the provider, which will be used to secure requests. SPI approach could be used too (endpoint then finds security provider using SPI). | | UndertowSecurityProvider | *sslContextParameters* (security) | To configure security using SSLContextParameters | | SSLContextParameters | *fireWebSocketChannelEvents* (websocket) | if true, the consumer will post notifications to the route when a new WebSocket peer connects, disconnects, etc. See UndertowConstants.EVENT_TYPE and EventType. | false | boolean | *sendTimeout* (websocket) | Timeout in milliseconds when sending to a websocket channel. The default timeout is 30000 (30 seconds). | 30000 | Integer diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java index e6ecbc0..00c6b93 100644 --- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java +++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java @@ -19,9 +19,13 @@ package org.apache.camel.component.undertow; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; +import java.util.Iterator; import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.ServiceLoader; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -35,6 +39,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.SSLContextParametersAware; import org.apache.camel.component.extension.ComponentVerifierExtension; +import org.apache.camel.component.undertow.spi.UndertowSecurityProvider; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.RestApiConsumerFactory; import org.apache.camel.spi.RestConfiguration; @@ -52,6 +57,8 @@ import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.PropertiesHelper; import org.apache.camel.util.URISupport; import org.apache.camel.util.UnsafeUriCharactersEncoder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Represents the component that manages {@link UndertowEndpoint}. @@ -60,6 +67,8 @@ import org.apache.camel.util.UnsafeUriCharactersEncoder; @Component("undertow") public class UndertowComponent extends DefaultComponent implements RestConsumerFactory, RestApiConsumerFactory, RestProducerFactory, SSLContextParametersAware { + private static final Logger LOG = LoggerFactory.getLogger(UndertowComponent.class); + private final Map<UndertowHostKey, UndertowHost> undertowRegistry = new ConcurrentHashMap<>(); private final Set<HttpHandlerRegistrationInfo> handlers = new LinkedHashSet<>(); @@ -77,7 +86,8 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF private Object securityConfiguration; @Metadata(label = "security") private String allowedRoles; - + @Metadata(label = "security") + private UndertowSecurityProvider securityProvider; public UndertowComponent() { this(null); @@ -155,6 +165,29 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF return doCreateConsumer(camelContext, processor, "GET", contextPath, null, null, null, configuration, parameters, true); } + private void initSecurityProvider() throws Exception { + Object securityConfiguration = getSecurityConfiguration(); + if (securityConfiguration != null) { + ServiceLoader<UndertowSecurityProvider> securityProvider = ServiceLoader.load(UndertowSecurityProvider.class); + + Iterator<UndertowSecurityProvider> iter = securityProvider.iterator(); + List<String> providers = new LinkedList(); + while (iter.hasNext()) { + UndertowSecurityProvider security = iter.next(); + //only securityProvider, who accepts security configuration, could be used + if (security.acceptConfiguration(securityConfiguration, null)) { + this.securityProvider = security; + LOG.info("Security provider found {}", securityProvider.getClass().getName()); + break; + } + providers.add(security.getClass().getName()); + } + if (this.securityProvider == null) { + LOG.info("Security provider for configuration {} not found {}", securityConfiguration, providers); + } + } + } + Consumer doCreateConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate, String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters, boolean api) throws Exception { String path = basePath; @@ -306,6 +339,10 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF protected void doStart() throws Exception { super.doStart(); + if (this.securityProvider == null) { + initSecurityProvider(); + } + RestConfiguration config = CamelContextHelper.getRestConfiguration(getCamelContext(), getComponentName()); // configure additional options on undertow configuration @@ -314,7 +351,7 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF } } - public HttpHandler registerEndpoint(UndertowConsumer consumer, HttpHandlerRegistrationInfo registrationInfo, SSLContext sslContext, HttpHandler handler) { + public HttpHandler registerEndpoint(UndertowConsumer consumer, HttpHandlerRegistrationInfo registrationInfo, SSLContext sslContext, HttpHandler handler) throws Exception { final URI uri = registrationInfo.getUri(); final UndertowHostKey key = new UndertowHostKey(uri.getHost(), uri.getPort(), sslContext); final UndertowHost host = undertowRegistry.computeIfAbsent(key, this::createUndertowHost); @@ -322,7 +359,13 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF host.validateEndpointURI(uri); handlers.add(registrationInfo); - return host.registerHandler(consumer, registrationInfo, handler); + + HttpHandler handlerWrapped = handler; + if (this.securityProvider != null) { + handlerWrapped = this.securityProvider.wrapHttpHandler(handler); + } + + return host.registerHandler(consumer, registrationInfo, handlerWrapped); } public void unregisterEndpoint(UndertowConsumer consumer, HttpHandlerRegistrationInfo registrationInfo, SSLContext sslContext) { @@ -435,4 +478,16 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF public void setAllowedRoles(String allowedRoles) { this.allowedRoles = allowedRoles; } + + /** + * Security provider allows plug in the provider, which will be used to secure requests. + * SPI approach could be used too (component then finds security provider using SPI). + */ + public void setSecurityProvider(UndertowSecurityProvider securityProvider) { + this.securityProvider = securityProvider; + } + + public UndertowSecurityProvider getSecurityProvider() { + return securityProvider; + } } diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java index 9f753e3..5061ea8 100644 --- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java +++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java @@ -83,8 +83,11 @@ public class UndertowConsumer extends DefaultConsumer implements HttpHandler, Su return (UndertowEndpoint) super.getEndpoint(); } - public List<String> getAllowedRoles() { + public List<String> computeAllowedRoles() { String allowedRolesString = getEndpoint().getAllowedRoles(); + if (allowedRolesString == null) { + allowedRolesString = getEndpoint().getComponent().getAllowedRoles(); + } return allowedRolesString == null ? null : Arrays.asList(allowedRolesString.split("\\s*,\\s*")); } @@ -179,7 +182,7 @@ public class UndertowConsumer extends DefaultConsumer implements HttpHandler, Su if (getEndpoint().getSecurityProvider() != null) { //security provider decides, whether endpoint is accessible - int statusCode = getEndpoint().getSecurityProvider().authenticate(httpExchange, getAllowedRoles()); + int statusCode = getEndpoint().getSecurityProvider().authenticate(httpExchange, computeAllowedRoles()); if (statusCode != StatusCodes.OK) { httpExchange.setStatusCode(statusCode); httpExchange.endExchange(); diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java index 2af5e03..4ccfe9f 100644 --- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java +++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java @@ -133,7 +133,8 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint, private Object securityConfiguration; @UriParam(label = "security", description = "Configuration used by UndertowSecurityProvider. Comma separated list of allowed roles.") private String allowedRoles; - + @UriParam(label = "security", description = "Security provider allows plug in the provider, which will be used to secure requests. " + + "SPI approach could be used too (endpoint then finds security provider using SPI).") private UndertowSecurityProvider securityProvider; public UndertowEndpoint(String uri, UndertowComponent component) { @@ -147,7 +148,11 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint, } public UndertowSecurityProvider getSecurityProvider() { - return securityProvider; + return this.securityProvider; + } + + public void setSecurityProvider(UndertowSecurityProvider securityProvider) { + this.securityProvider = securityProvider; } @Override @@ -454,16 +459,15 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint, } public Object getSecurityConfiguration() { - return this.securityConfiguration == null ? getComponent().getSecurityConfiguration() : this.securityConfiguration; + return this.securityConfiguration; } public void setSecurityConfiguration(Object securityConfiguration) { this.securityConfiguration = securityConfiguration; } - public String getAllowedRoles() { - return allowedRoles == null ? getComponent().getAllowedRoles() : allowedRoles; + return allowedRoles; } public void setAllowedRoles(String allowedRoles) { @@ -474,7 +478,9 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint, protected void doStart() throws Exception { super.doStart(); - initSecurityProvider(); + if (this.securityProvider == null) { + initSecurityProvider(); + } final String scheme = httpURI.getScheme(); this.isWebSocket = UndertowConstants.WS_PROTOCOL.equalsIgnoreCase(scheme) || UndertowConstants.WSS_PROTOCOL.equalsIgnoreCase(scheme); @@ -555,6 +561,9 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint, LOG.info("Security provider for configuration {} not found {}", securityConfiguration, providers); } } + if (this.securityProvider == null) { + this.securityProvider = getComponent().getSecurityProvider(); + } } /** diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/spi/UndertowSecurityProvider.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/spi/UndertowSecurityProvider.java index 426c261..3d7b1c9 100644 --- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/spi/UndertowSecurityProvider.java +++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/spi/UndertowSecurityProvider.java @@ -19,6 +19,7 @@ package org.apache.camel.component.undertow.spi; import java.util.List; import java.util.function.BiConsumer; +import io.undertow.server.HttpHandler; import io.undertow.server.HttpServerExchange; /** @@ -61,4 +62,14 @@ public interface UndertowSecurityProvider { * @return True if securityProvider is initialized from data and is able to authenticate requests. */ boolean acceptConfiguration(Object configuration, String endpointUri) throws Exception; + + /** + * SecurityProvider may change instance of undertow httpHandler during endpoint registration. + * + * @param httpHandler Original httpHandler + * @return New httpHandler (default behavior is to return the same handler) + */ + default HttpHandler wrapHttpHandler(HttpHandler httpHandler) throws Exception { + return httpHandler; + } } diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/AbstractSecurityProviderTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/AbstractSecurityProviderTest.java index d562b2c..86abde6 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/AbstractSecurityProviderTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/AbstractSecurityProviderTest.java @@ -23,7 +23,9 @@ import java.net.URL; import java.util.Collections; import java.util.List; import java.util.function.BiConsumer; +import java.util.function.Function; +import io.undertow.server.HttpHandler; import io.undertow.server.HttpServerExchange; import io.undertow.util.AttachmentKey; import io.undertow.util.StatusCodes; @@ -38,7 +40,7 @@ import org.junit.BeforeClass; */ public abstract class AbstractSecurityProviderTest extends BaseUndertowTest { - private static final String PRINCIPAL_PARAMETER = "principal_parameter"; + static final String PRINCIPAL_PARAMETER = "principal_parameter"; MockSecurityConfiguration securityConfiguration; @@ -73,6 +75,14 @@ public abstract class AbstractSecurityProviderTest extends BaseUndertowTest { } return false; } + + @Override + public HttpHandler wrapHttpHandler(HttpHandler httpHandler) throws Exception { + if (configuration.getWrapHttpHandler() != null) { + return configuration.getWrapHttpHandler().apply(httpHandler); + } + return httpHandler; + } } public static final class MockSecurityConfiguration { @@ -81,6 +91,8 @@ public abstract class AbstractSecurityProviderTest extends BaseUndertowTest { private boolean accept = true; + private Function<HttpHandler, HttpHandler> wrapHttpHandler; + public String getRoleToAssign() { return roleToAssign; } @@ -96,6 +108,14 @@ public abstract class AbstractSecurityProviderTest extends BaseUndertowTest { public void setAccept(boolean accept) { this.accept = accept; } + + public Function<HttpHandler, HttpHandler> getWrapHttpHandler() { + return wrapHttpHandler; + } + + public void setWrapHttpHandler(Function<HttpHandler, HttpHandler> wrapHttpHandler) { + this.wrapHttpHandler = wrapHttpHandler; + } } @Override diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderHttpHandlerTest.java similarity index 67% copy from components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderTest.java copy to components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderHttpHandlerTest.java index d6808c44..53ec272 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderHttpHandlerTest.java @@ -16,36 +16,27 @@ */ package org.apache.camel.component.undertow.spi; +import io.undertow.util.StatusCodes; +import org.apache.camel.CamelContext; import org.apache.camel.CamelExecutionException; -import org.apache.camel.Exchange; import org.apache.camel.http.base.HttpOperationFailedException; -import org.junit.Assert; import org.junit.Test; /** * Basic tests with securityProvider, tests whether securityProvider allows or denies access. */ -public class SecurityProviderTest extends AbstractSecurityProviderTest { +public class SecurityProviderHttpHandlerTest extends AbstractSecurityProviderTest { - - @Test - public void testSecuredAllowed() throws Exception { - securityConfiguration.setRoleToAssign("user"); - - getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "GET"); - - String out = template.requestBody("undertow:http://localhost:{{port}}/foo", null, String.class); - - Assert.assertEquals("user", out); - - assertMockEndpointsSatisfied(); + @Override + protected CamelContext createCamelContext() throws Exception { + CamelContext camelContext = super.createCamelContext(); + securityConfiguration.setWrapHttpHandler(f -> null); + return camelContext; } @Test - public void testSecuredNotAllowed() throws Exception { - securityConfiguration.setRoleToAssign("admin"); - - getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "GET"); + public void testNullHttpHandler() throws Exception { + securityConfiguration.setRoleToAssign("user"); try { template.requestBody("undertow:http://localhost:{{port}}/foo", null, String.class); @@ -54,8 +45,7 @@ public class SecurityProviderTest extends AbstractSecurityProviderTest { } catch (CamelExecutionException e) { HttpOperationFailedException he = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause()); - assertEquals(403, he.getStatusCode()); + assertEquals(StatusCodes.METHOD_NOT_ALLOWED, he.getStatusCode()); } } - } diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderRolesFromComponentTest.java similarity index 63% copy from components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderTest.java copy to components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderRolesFromComponentTest.java index d6808c44..028ab1d 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderRolesFromComponentTest.java @@ -16,17 +16,28 @@ */ package org.apache.camel.component.undertow.spi; +import io.undertow.util.StatusCodes; +import org.apache.camel.CamelContext; import org.apache.camel.CamelExecutionException; import org.apache.camel.Exchange; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.undertow.UndertowComponent; import org.apache.camel.http.base.HttpOperationFailedException; import org.junit.Assert; import org.junit.Test; /** - * Basic tests with securityProvider, tests whether securityProvider allows or denies access. + * Tests whether security provider parameters defined in component are used. */ -public class SecurityProviderTest extends AbstractSecurityProviderTest { +public class SecurityProviderRolesFromComponentTest extends AbstractSecurityProviderTest { + @Override + protected CamelContext createCamelContext() throws Exception { + CamelContext camelContext = super.createCamelContext(); + UndertowComponent component = camelContext.getComponent("undertow", UndertowComponent.class); + component.setAllowedRoles("user"); + return camelContext; + } @Test public void testSecuredAllowed() throws Exception { @@ -54,8 +65,20 @@ public class SecurityProviderTest extends AbstractSecurityProviderTest { } catch (CamelExecutionException e) { HttpOperationFailedException he = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause()); - assertEquals(403, he.getStatusCode()); + assertEquals(StatusCodes.FORBIDDEN, he.getStatusCode()); } } + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("undertow:http://localhost:{{port}}/foo") + .to("mock:input") + .transform(simple("${in.header." + PRINCIPAL_PARAMETER + "}")); + } + }; + } + } diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderTest.java index d6808c44..71b87ab 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/spi/SecurityProviderTest.java @@ -16,6 +16,7 @@ */ package org.apache.camel.component.undertow.spi; +import io.undertow.util.StatusCodes; import org.apache.camel.CamelExecutionException; import org.apache.camel.Exchange; import org.apache.camel.http.base.HttpOperationFailedException; @@ -54,7 +55,7 @@ public class SecurityProviderTest extends AbstractSecurityProviderTest { } catch (CamelExecutionException e) { HttpOperationFailedException he = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause()); - assertEquals(403, he.getStatusCode()); + assertEquals(StatusCodes.FORBIDDEN, he.getStatusCode()); } } diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ElytronComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ElytronComponentBuilderFactory.java index 7ae625e..b6947c0 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ElytronComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ElytronComponentBuilderFactory.java @@ -219,6 +219,21 @@ public interface ElytronComponentBuilderFactory { return this; } /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (component then finds + * security provider using SPI). + * + * The option is a: + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default ElytronComponentBuilder securityProvider( + org.apache.camel.component.undertow.spi.UndertowSecurityProvider securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** * To configure security using SSLContextParameters. * * The option is a: @@ -272,6 +287,7 @@ public interface ElytronComponentBuilderFactory { case "undertowHttpBinding": ((ElytronComponent) component).setUndertowHttpBinding((org.apache.camel.component.undertow.UndertowHttpBinding) value); return true; case "allowedRoles": ((ElytronComponent) component).setAllowedRoles((java.lang.String) value); return true; case "securityConfiguration": ((ElytronComponent) component).setSecurityConfiguration((java.lang.Object) value); return true; + case "securityProvider": ((ElytronComponent) component).setSecurityProvider((org.apache.camel.component.undertow.spi.UndertowSecurityProvider) value); return true; case "sslContextParameters": ((ElytronComponent) component).setSslContextParameters((org.apache.camel.support.jsse.SSLContextParameters) value); return true; case "useGlobalSslContextParameters": ((ElytronComponent) component).setUseGlobalSslContextParameters((boolean) value); return true; default: return false; diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/UndertowComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/UndertowComponentBuilderFactory.java index 044c28e..d8569e4 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/UndertowComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/UndertowComponentBuilderFactory.java @@ -175,6 +175,21 @@ public interface UndertowComponentBuilderFactory { return this; } /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (component then finds + * security provider using SPI). + * + * The option is a: + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default UndertowComponentBuilder securityProvider( + org.apache.camel.component.undertow.spi.UndertowSecurityProvider securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** * To configure security using SSLContextParameters. * * The option is a: @@ -225,6 +240,7 @@ public interface UndertowComponentBuilderFactory { case "undertowHttpBinding": ((UndertowComponent) component).setUndertowHttpBinding((org.apache.camel.component.undertow.UndertowHttpBinding) value); return true; case "allowedRoles": ((UndertowComponent) component).setAllowedRoles((java.lang.String) value); return true; case "securityConfiguration": ((UndertowComponent) component).setSecurityConfiguration((java.lang.Object) value); return true; + case "securityProvider": ((UndertowComponent) component).setSecurityProvider((org.apache.camel.component.undertow.spi.UndertowSecurityProvider) value); return true; case "sslContextParameters": ((UndertowComponent) component).setSslContextParameters((org.apache.camel.support.jsse.SSLContextParameters) value); return true; case "useGlobalSslContextParameters": ((UndertowComponent) component).setUseGlobalSslContextParameters((boolean) value); return true; default: return false; diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElytronEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElytronEndpointBuilderFactory.java index bc98945..4269df4 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElytronEndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElytronEndpointBuilderFactory.java @@ -285,6 +285,36 @@ public interface ElytronEndpointBuilderFactory { return this; } /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option is a: + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default ElytronEndpointConsumerBuilder securityProvider( + Object securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option will be converted to a + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default ElytronEndpointConsumerBuilder securityProvider( + String securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** * To configure security using SSLContextParameters. * * The option is a: @@ -963,6 +993,36 @@ public interface ElytronEndpointBuilderFactory { return this; } /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option is a: + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default ElytronEndpointProducerBuilder securityProvider( + Object securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option will be converted to a + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default ElytronEndpointProducerBuilder securityProvider( + String securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** * To configure security using SSLContextParameters. * * The option is a: @@ -1287,6 +1347,34 @@ public interface ElytronEndpointBuilderFactory { return this; } /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option is a: + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default ElytronEndpointBuilder securityProvider(Object securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option will be converted to a + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default ElytronEndpointBuilder securityProvider(String securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** * To configure security using SSLContextParameters. * * The option is a: diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/UndertowEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/UndertowEndpointBuilderFactory.java index f2b4890..ba7e7b7 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/UndertowEndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/UndertowEndpointBuilderFactory.java @@ -287,6 +287,36 @@ public interface UndertowEndpointBuilderFactory { return this; } /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option is a: + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default UndertowEndpointConsumerBuilder securityProvider( + Object securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option will be converted to a + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default UndertowEndpointConsumerBuilder securityProvider( + String securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** * To configure security using SSLContextParameters. * * The option is a: @@ -967,6 +997,36 @@ public interface UndertowEndpointBuilderFactory { return this; } /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option is a: + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default UndertowEndpointProducerBuilder securityProvider( + Object securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option will be converted to a + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default UndertowEndpointProducerBuilder securityProvider( + String securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** * To configure security using SSLContextParameters. * * The option is a: @@ -1292,6 +1352,34 @@ public interface UndertowEndpointBuilderFactory { return this; } /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option is a: + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default UndertowEndpointBuilder securityProvider(Object securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** + * Security provider allows plug in the provider, which will be used to + * secure requests. SPI approach could be used too (endpoint then finds + * security provider using SPI). + * + * The option will be converted to a + * <code>org.apache.camel.component.undertow.spi.UndertowSecurityProvider</code> type. + * + * Group: security + */ + default UndertowEndpointBuilder securityProvider(String securityProvider) { + doSetProperty("securityProvider", securityProvider); + return this; + } + /** * To configure security using SSLContextParameters. * * The option is a: