You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/03/04 08:53:29 UTC

[GitHub] [camel] essobedo opened a new pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

essobedo opened a new pull request #7105:
URL: https://github.com/apache/camel/pull/7105


   Fix for https://issues.apache.org/jira/browse/CAMEL-17717
   
   ## Motivation
   
   The class `SecurityRequirementsDefinition` contains only one property which should be moved directly into `RestDefinition` for the sake of simplicity.
   
   ## Modifications:
   
   * Move all the fields and methods of `SecurityRequirementsDefinition` into `RestDefinition`
   
   ## Result
   
   The mappings (XML, YAML...) remain the same but the class `SecurityRequirementsDefinition` has been removed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] essobedo edited a comment on pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
essobedo edited a comment on pull request #7105:
URL: https://github.com/apache/camel/pull/7105#issuecomment-1059377795


   @davsclaus Actually all the methods that you refer to are the methods that were in the class `SecurityRequirementsDefinition` to remove (I forgot to remove it BTW), so I simply moved them into `RestDefinition` as is


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] essobedo commented on a change in pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
essobedo commented on a change in pull request #7105:
URL: https://github.com/apache/camel/pull/7105#discussion_r819780870



##########
File path: core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
##########
@@ -80,11 +84,13 @@
     @XmlElement(name = "securityDefinitions") // use the name Swagger/OpenAPI uses
     @Metadata(label = "security")
     private RestSecuritiesDefinition securityDefinitions;
-    @XmlElement(name = "securityRequirements") // use the name Swagger/OpenAPI uses
+    @XmlElement
     @Metadata(label = "security")
-    private SecurityRequirementsDefinition securityRequirements;
+    private List<SecurityDefinition> securityRequirements = new ArrayList<>();
     @XmlElementRef
     private List<VerbDefinition> verbs = new ArrayList<>();
+    @XmlTransient
+    private Map<String, SecurityDefinition> itemsMap = new HashMap<>();

Review comment:
       This comes from https://github.com/apache/camel/blob/main/core/camel-core-model/src/main/java/org/apache/camel/model/rest/SecurityRequirementsDefinition.java#L46-L47




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] essobedo merged pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
essobedo merged pull request #7105:
URL: https://github.com/apache/camel/pull/7105


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] essobedo commented on pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
essobedo commented on pull request #7105:
URL: https://github.com/apache/camel/pull/7105#issuecomment-1059377795


   @davsclaus Actually all the methods that you refer to are the methods that were in the class `SecurityRequirementsDefinition` to remove (I forgot to remove it BTW), so I simply moved them into `RestDefinition` as such


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] essobedo commented on a change in pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
essobedo commented on a change in pull request #7105:
URL: https://github.com/apache/camel/pull/7105#discussion_r819781893



##########
File path: core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
##########
@@ -170,15 +176,17 @@ public void setSecurityDefinitions(RestSecuritiesDefinition securityDefinitions)
         this.securityDefinitions = securityDefinitions;
     }
 
-    public SecurityRequirementsDefinition getSecurityRequirements() {
+    public List<SecurityDefinition> getSecurityRequirements() {
         return securityRequirements;
     }
 
     /**
      * Sets the security requirement(s) for all endpoints.
      */
-    public void setSecurityRequirements(SecurityRequirementsDefinition securityRequirements) {
-        this.securityRequirements = securityRequirements;
+    public void setSecurityRequirements(Collection<SecurityDefinition> securityRequirements) {

Review comment:
       This comes from https://github.com/apache/camel/blob/main/core/camel-core-model/src/main/java/org/apache/camel/model/rest/SecurityRequirementsDefinition.java#L87-L91




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] essobedo commented on pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
essobedo commented on pull request #7105:
URL: https://github.com/apache/camel/pull/7105#issuecomment-1059382699


   I will add the proper commit to remove the class as expected


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] essobedo commented on pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
essobedo commented on pull request #7105:
URL: https://github.com/apache/camel/pull/7105#issuecomment-1059421883


   I finally assumed that your answer was yes so I addressed your comments


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus commented on pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
davsclaus commented on pull request #7105:
URL: https://github.com/apache/camel/pull/7105#issuecomment-1059436197


   Ah okay this code was contributed by community user so I guess we just accepted it back then - to make rest-dsl have a way to configure security


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus commented on a change in pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
davsclaus commented on a change in pull request #7105:
URL: https://github.com/apache/camel/pull/7105#discussion_r819563759



##########
File path: core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
##########
@@ -606,6 +619,10 @@ public RestDefinition security(String key, String scopes) {
         return this;
     }
 
+    public Collection<SecurityDefinition> securityRequirements() {

Review comment:
       What is this method for?

##########
File path: core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
##########
@@ -170,15 +176,17 @@ public void setSecurityDefinitions(RestSecuritiesDefinition securityDefinitions)
         this.securityDefinitions = securityDefinitions;
     }
 
-    public SecurityRequirementsDefinition getSecurityRequirements() {
+    public List<SecurityDefinition> getSecurityRequirements() {
         return securityRequirements;
     }
 
     /**
      * Sets the security requirement(s) for all endpoints.
      */
-    public void setSecurityRequirements(SecurityRequirementsDefinition securityRequirements) {
-        this.securityRequirements = securityRequirements;
+    public void setSecurityRequirements(Collection<SecurityDefinition> securityRequirements) {

Review comment:
       The getter/setter should be same type, eg List

##########
File path: core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
##########
@@ -80,11 +84,13 @@
     @XmlElement(name = "securityDefinitions") // use the name Swagger/OpenAPI uses
     @Metadata(label = "security")
     private RestSecuritiesDefinition securityDefinitions;
-    @XmlElement(name = "securityRequirements") // use the name Swagger/OpenAPI uses
+    @XmlElement
     @Metadata(label = "security")
-    private SecurityRequirementsDefinition securityRequirements;
+    private List<SecurityDefinition> securityRequirements = new ArrayList<>();
     @XmlElementRef
     private List<VerbDefinition> verbs = new ArrayList<>();
+    @XmlTransient
+    private Map<String, SecurityDefinition> itemsMap = new HashMap<>();

Review comment:
       Can we avoid this internal special map as this is not common practice in the model classes, so can you try to find another way.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] essobedo commented on pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
essobedo commented on pull request #7105:
URL: https://github.com/apache/camel/pull/7105#issuecomment-1059395121


   @davsclaus What should I do? Apply your comments within the context of this PR or keep it as it is?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] essobedo commented on a change in pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
essobedo commented on a change in pull request #7105:
URL: https://github.com/apache/camel/pull/7105#discussion_r819781512



##########
File path: core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
##########
@@ -606,6 +619,10 @@ public RestDefinition security(String key, String scopes) {
         return this;
     }
 
+    public Collection<SecurityDefinition> securityRequirements() {

Review comment:
       This comes from https://github.com/apache/camel/blob/main/core/camel-core-model/src/main/java/org/apache/camel/model/rest/SecurityRequirementsDefinition.java#L76-L78




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] essobedo edited a comment on pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
essobedo edited a comment on pull request #7105:
URL: https://github.com/apache/camel/pull/7105#issuecomment-1059377795


   @davsclaus Actually all the methods that you refer to are the methods that were in the class `SecurityRequirementsDefinition` to remove (I forgot to remove it BTW), so I simply moved them into `RestDefinition` as they are


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] essobedo commented on pull request #7105: CAMEL-17717: REST DSL securityRequirements cleanup

Posted by GitBox <gi...@apache.org>.
essobedo commented on pull request #7105:
URL: https://github.com/apache/camel/pull/7105#issuecomment-1058964141


   Waiting for https://github.com/apache/camel/pull/7104


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org