You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by il...@apache.org on 2018/01/26 12:07:28 UTC

[cxf] branch 3.1.x-fixes updated: [CXF-7525] Fixing Basic Authentication translation

This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.1.x-fixes by this push:
     new ffee295  [CXF-7525] Fixing Basic Authentication translation
ffee295 is described below

commit ffee29551ea7f1f2f511ece45eca4463b1d94b8f
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Fri Jan 26 13:07:18 2018 +0100

    [CXF-7525] Fixing Basic Authentication translation
---
 .../jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java
index ee45fbb..67dafb7 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java
+++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerToOpenApiConversionUtils.java
@@ -143,9 +143,17 @@ public final class SwaggerToOpenApiConversionUtils {
         if (s2Defs != null) {
             comps.setProperty("schemas", s2Defs);
         }
-        Object s2SecurityDefs = sw2.getProperty("securityDefinitions");
+        JsonMapObject s2SecurityDefs = sw2.getJsonMapProperty("securityDefinitions");
         if (s2SecurityDefs != null) {
             comps.setProperty("securitySchemes", s2SecurityDefs);
+
+            for (String property : s2SecurityDefs.asMap().keySet()) {
+                JsonMapObject securityScheme = s2SecurityDefs.getJsonMapProperty(property);
+                if ("basic".equals(securityScheme.getStringProperty("type"))) {
+                    securityScheme.setProperty("type", "http");
+                    securityScheme.setProperty("scheme", "basic");
+                }
+            }
         }
         
         sw3.setProperty("components", comps);

-- 
To stop receiving notification emails like this one, please contact
ilgrosso@apache.org.