This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit b3d73338e17061bed352ee52cf9564d41257f2fb Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat May 15 09:21:21 2021 +0200 CAMEL-16609 rest dsl - Add more security models for JWT bearer tokens etc --- .../org/apache/camel/catalog/models.properties | 3 + .../org/apache/camel/catalog/models/apiKey.json | 1 + .../apache/camel/catalog/models/bearerToken.json | 18 +++++ .../org/apache/camel/catalog/models/mutualTLS.json | 17 +++++ .../org/apache/camel/catalog/models/oauth2.json | 3 +- .../apache/camel/catalog/models/openIdConnect.json | 18 +++++ .../camel/catalog/models/securityDefinitions.json | 2 +- .../apache/camel/catalog/schemas/camel-spring.xsd | 80 ++++++++++++++++++++++ 8 files changed, 140 insertions(+), 2 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties index 353c9ff..d0d5f2f 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties @@ -10,6 +10,7 @@ batch-config bean beanPostProcessor beanio +bearerToken bindy blacklistServiceFilter cachingServiceDiscovery @@ -95,12 +96,14 @@ marshal method mime-multipart multicast +mutualTLS mvel oauth2 ognl onCompletion onException onFallback +openIdConnect optimisticLockRetryPolicy otherwise outputType diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/apiKey.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/apiKey.json index 3f9b203..10e78ce 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/apiKey.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/apiKey.json @@ -14,6 +14,7 @@ "name": { "kind": "attribute", "displayName": "Name", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the header or query parameter to be used." }, "inHeader": { "kind": "attribute", "displayName": "In Header", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To use header as the location of the API key." }, "inQuery": { "kind": "attribute", "displayName": "In Query", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To use query parameter as the location of the API key." }, + "inCookie": { "kind": "attribute", "displayName": "In Cookie", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To use a cookie as the location of the API key." }, "key": { "kind": "attribute", "displayName": "Key", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Key used to refer to this security definition" }, "description": { "kind": "attribute", "displayName": "Description", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "A short description for security scheme." } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/bearerToken.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/bearerToken.json new file mode 100644 index 0000000..d0f1b12 --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/bearerToken.json @@ -0,0 +1,18 @@ +{ + "model": { + "kind": "model", + "name": "bearerToken", + "title": "Bearer Token", + "description": "Rest security bearer token authentication definition", + "deprecated": false, + "label": "rest,security", + "javaType": "org.apache.camel.model.rest.RestSecurityBearerToken", + "input": false, + "output": false + }, + "properties": { + "format": { "kind": "attribute", "displayName": "Format", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "A hint to the client to identify how the bearer token is formatted." }, + "key": { "kind": "attribute", "displayName": "Key", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Key used to refer to this security definition" }, + "description": { "kind": "attribute", "displayName": "Description", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "A short description for security scheme." } + } +} diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/mutualTLS.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/mutualTLS.json new file mode 100644 index 0000000..64bd471 --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/mutualTLS.json @@ -0,0 +1,17 @@ +{ + "model": { + "kind": "model", + "name": "mutualTLS", + "title": "Mutual TLS", + "description": "Rest security mutual TLS authentication definition", + "deprecated": false, + "label": "rest,security", + "javaType": "org.apache.camel.model.rest.RestSecurityMutualTLS", + "input": false, + "output": false + }, + "properties": { + "key": { "kind": "attribute", "displayName": "Key", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Key used to refer to this security definition" }, + "description": { "kind": "attribute", "displayName": "Description", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "A short description for security scheme." } + } +} diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/oauth2.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/oauth2.json index 17a24a9..af933c1 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/oauth2.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/oauth2.json @@ -13,7 +13,8 @@ "properties": { "authorizationUrl": { "kind": "attribute", "displayName": "Authorization Url", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The authorization URL to be used for this flow. This SHOULD be in the form of a URL. Required for implicit and access code flows" }, "tokenUrl": { "kind": "attribute", "displayName": "Token Url", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The token URL to be used for this flow. This SHOULD be in the form of a URL. Required for password, application, and access code flows." }, - "flow": { "kind": "attribute", "displayName": "Flow", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "accessCode", "application", "implicit", "password" ], "deprecated": false, "autowired": false, "secret": false, "description": "The flow used by the OAuth2 security scheme. Valid values are implicit, password, application or accessCode." }, + "refreshUrl": { "kind": "attribute", "displayName": "Refresh Url", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL." }, + "flow": { "kind": "attribute", "displayName": "Flow", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "accessCode", "application", "authorizationCode", "clientCredentials", "implicit", "password" ], "deprecated": false, "autowired": false, "secret": false, "description": "The flow used by the OAuth2 security scheme. Valid values are implicit, password, application or accessCode." }, "scopes": { "kind": "element", "displayName": "Scopes", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.rest.RestPropertyDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "The available scopes for an OAuth2 security scheme" }, "key": { "kind": "attribute", "displayName": "Key", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Key used to refer to this security definition" }, "description": { "kind": "attribute", "displayName": "Description", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "A short description for security scheme." } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openIdConnect.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openIdConnect.json new file mode 100644 index 0000000..9418595 --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openIdConnect.json @@ -0,0 +1,18 @@ +{ + "model": { + "kind": "model", + "name": "openIdConnect", + "title": "Open Id Connect", + "description": "Rest security OpenID Connect definition", + "deprecated": false, + "label": "rest,security", + "javaType": "org.apache.camel.model.rest.RestSecurityOpenIdConnect", + "input": false, + "output": false + }, + "properties": { + "url": { "kind": "attribute", "displayName": "Url", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "OpenId Connect URL to discover OAuth2 configuration values." }, + "key": { "kind": "attribute", "displayName": "Key", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Key used to refer to this security definition" }, + "description": { "kind": "attribute", "displayName": "Description", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "A short description for security scheme." } + } +} diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/securityDefinitions.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/securityDefinitions.json index 6ab871b..e43059c 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/securityDefinitions.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/securityDefinitions.json @@ -11,6 +11,6 @@ "output": false }, "properties": { - "securityDefinitions": { "kind": "element", "displayName": "Security Definitions", "required": true, "type": "array", "javaType": "java.util.List<org.apache.camel.model.rest.RestSecurityDefinition>", "oneOf": [ "apiKey", "basicAuth", "oauth2" ], "deprecated": false, "autowired": false, "secret": false, "description": "Security definitions" } + "securityDefinitions": { "kind": "element", "displayName": "Security Definitions", "required": true, "type": "array", "javaType": "java.util.List<org.apache.camel.model.rest.RestSecurityDefinition>", "oneOf": [ "apiKey", "basicAuth", "bearer", "mutualTLS", "oauth2", "openIdConnect" ], "deprecated": false, "autowired": false, "secret": false, "description": "Security definitions" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd index a87c100..e202ad2 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd @@ -98,6 +98,14 @@ or fixed length formats). </xs:annotation> </xs:element> + <xs:element name="bearerToken" type="tns:restSecurityBearerToken"> + <xs:annotation> + <xs:documentation xml:lang="en"><![CDATA[ +Rest security bearer token authentication definition + ]]></xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="bindy" type="tns:bindyDataFormat"> <xs:annotation> <xs:documentation xml:lang="en"><![CDATA[ @@ -821,6 +829,14 @@ Routes the same message to multiple paths either sequentially or in parallel. </xs:annotation> </xs:element> + <xs:element name="mutualTLS" type="tns:restSecurityMutualTLS"> + <xs:annotation> + <xs:documentation xml:lang="en"><![CDATA[ +Rest security mutual TLS authentication definition + ]]></xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="mvel" type="tns:mvelExpression"> <xs:annotation> <xs:documentation xml:lang="en"><![CDATA[ @@ -870,6 +886,14 @@ Route to be executed when Hystrix EIP executes fallback </xs:annotation> </xs:element> + <xs:element name="openIdConnect" type="tns:restSecurityOpenIdConnect"> + <xs:annotation> + <xs:documentation xml:lang="en"><![CDATA[ +Rest security OpenID Connect definition + ]]></xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="optimisticLockRetryPolicy" type="tns:optimisticLockRetryPolicyDefinition"> <xs:annotation> <xs:documentation xml:lang="en"><![CDATA[ @@ -14482,7 +14506,10 @@ is true. <xs:choice maxOccurs="unbounded" minOccurs="0"> <xs:element ref="tns:apiKey"/> <xs:element ref="tns:basicAuth"/> + <xs:element name="bearer" type="tns:restSecurityBearerToken"/> <xs:element ref="tns:oauth2"/> + <xs:element ref="tns:openIdConnect"/> + <xs:element ref="tns:mutualTLS"/> </xs:choice> </xs:sequence> </xs:complexType> @@ -14512,6 +14539,13 @@ To use query parameter as the location of the API key. Default value: false ]]></xs:documentation> </xs:annotation> </xs:attribute> + <xs:attribute name="inCookie" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"><![CDATA[ +To use a cookie as the location of the API key. Default value: false + ]]></xs:documentation> + </xs:annotation> + </xs:attribute> </xs:extension> </xs:complexContent> </xs:complexType> @@ -14542,6 +14576,21 @@ A short description for security scheme. </xs:complexContent> </xs:complexType> + <xs:complexType name="restSecurityBearerToken"> + <xs:complexContent> + <xs:extension base="tns:restSecurityDefinition"> + <xs:sequence/> + <xs:attribute name="format" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"><![CDATA[ +A hint to the client to identify how the bearer token is formatted. + ]]></xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="restSecurityOAuth2"> <xs:complexContent> <xs:extension base="tns:restSecurityDefinition"> @@ -14570,6 +14619,14 @@ Required for password, application, and access code flows. ]]></xs:documentation> </xs:annotation> </xs:attribute> + <xs:attribute name="refreshUrl" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"><![CDATA[ +The URL to be used for obtaining refresh tokens. This MUST be in the form of a +URL. + ]]></xs:documentation> + </xs:annotation> + </xs:attribute> <xs:attribute name="flow" type="xs:string"> <xs:annotation> <xs:documentation xml:lang="en"><![CDATA[ @@ -14582,6 +14639,29 @@ password, application or accessCode. </xs:complexContent> </xs:complexType> + <xs:complexType name="restSecurityOpenIdConnect"> + <xs:complexContent> + <xs:extension base="tns:restSecurityDefinition"> + <xs:sequence/> + <xs:attribute name="url" type="xs:string" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en"><![CDATA[ +OpenId Connect URL to discover OAuth2 configuration values. + ]]></xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="restSecurityMutualTLS"> + <xs:complexContent> + <xs:extension base="tns:restSecurityDefinition"> + <xs:sequence/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="restSecuritiesRequirement"> <xs:sequence> <xs:element maxOccurs="unbounded" minOccurs="0" name="securityRequirement" type="tns:securityDefinition"/>