cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-7137] Adding a Map of SecuritySchemeDefinitions property
Date Mon, 28 Nov 2016 11:10:15 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 06cfab8c3 -> cbc9a5f5e


[CXF-7137] Adding a Map of SecuritySchemeDefinitions property


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/cbc9a5f5
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/cbc9a5f5
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/cbc9a5f5

Branch: refs/heads/3.1.x-fixes
Commit: cbc9a5f5e0374e04a84eff2bd22395523dee13a8
Parents: 06cfab8
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Nov 28 11:08:53 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Nov 28 11:09:58 2016 +0000

----------------------------------------------------------------------
 .../org/apache/cxf/jaxrs/swagger/Swagger2Feature.java  | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/cbc9a5f5/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
----------------------------------------------------------------------
diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
index b417927..7dbda71 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
+++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
@@ -69,6 +69,8 @@ import io.swagger.jaxrs.config.DefaultReaderConfig;
 import io.swagger.jaxrs.config.ReaderConfig;
 import io.swagger.jaxrs.config.SwaggerContextService;
 import io.swagger.jaxrs.listing.ApiListingResource;
+import io.swagger.models.Swagger;
+import io.swagger.models.auth.SecuritySchemeDefinition;
 
 @Provider(value = Type.Feature, scope = Scope.Server)
 public class Swagger2Feature extends AbstractSwaggerFeature {
@@ -94,6 +96,8 @@ public class Swagger2Feature extends AbstractSwaggerFeature {
     
     private boolean dynamicBasePath;
     
+    private Map<String, SecuritySchemeDefinition> securityDefinitions;
+    
     @Override
     protected void calculateDefaultBasePath(Server server) {
         dynamicBasePath = true;
@@ -191,6 +195,11 @@ public class Swagger2Feature extends AbstractSwaggerFeature {
         beanConfig.setPrettyPrint(isPrettyPrint());
         beanConfig.setFilterClass(getFilterClass());
         
+        Swagger swagger = beanConfig.getSwagger();
+        if (swagger != null && securityDefinitions != null) {
+            swagger.setSecurityDefinitions(securityDefinitions);
+        }
+        
         swagger2Serializers.setBeanConfig(beanConfig);
     }
 
@@ -270,6 +279,10 @@ public class Swagger2Feature extends AbstractSwaggerFeature {
         this.swaggerUiMediaTypes = swaggerUiMediaTypes;
     }
 
+    public void setSecurityDefinitions(Map<String, SecuritySchemeDefinition> securityDefinitions)
{
+        this.securityDefinitions = securityDefinitions;
+    }
+
     private class ServletConfigProvider implements ContextProvider<ServletConfig> {
 
         @Override


Mime
View raw message