diff --git a/spotbugs.xml b/spotbugs.xml index 300363c..0b9bd30 100644 --- a/spotbugs.xml +++ b/spotbugs.xml @@ -15,4 +15,15 @@ limitations under the License. --> - + + + + + + + + + + + + diff --git a/src/main/java/io/federecio/dropwizard/swagger/SwaggerBundleConfiguration.java b/src/main/java/io/federecio/dropwizard/swagger/SwaggerBundleConfiguration.java index 1d6d840..b3ed185 100644 --- a/src/main/java/io/federecio/dropwizard/swagger/SwaggerBundleConfiguration.java +++ b/src/main/java/io/federecio/dropwizard/swagger/SwaggerBundleConfiguration.java @@ -32,10 +32,12 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Strings; import io.swagger.v3.oas.integration.SwaggerConfiguration; +import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.security.SecurityRequirement; import io.swagger.v3.oas.models.servers.Server; import java.util.ArrayList; import java.util.Arrays; @@ -79,6 +81,10 @@ public class SwaggerBundleConfiguration implements Cloneable { @Nullable private List servers; + @Nullable private List security; + + @Nullable private Components components; + @Nullable private String customJavascript; private SwaggerViewConfiguration swaggerViewConfiguration = new SwaggerViewConfiguration(); @@ -317,6 +323,28 @@ public void setServers(List servers) { this.servers = servers != null ? new ArrayList<>(servers) : null; } + @Nullable + @JsonProperty + public List getSecurity() { + return security != null ? new ArrayList<>(security) : null; + } + + @JsonProperty + public void setSecurity(List security) { + this.security = security != null ? new ArrayList<>(security) : null; + } + + @Nullable + @JsonProperty + public Components getComponents() { + return components; + } + + @JsonProperty + public void setComponents(Components components) { + this.components = components; + } + @Nullable @JsonProperty public String getCustomJavascript() { @@ -358,7 +386,7 @@ public SwaggerConfiguration build() { final String[] exclusions = {SwaggerResource.PATH}; return new SwaggerConfiguration() - .openAPI(oas.info(info).servers(servers)) + .openAPI(oas.info(info).servers(servers).security(security).components(components)) .prettyPrint(prettyPrint) .readAllResources(readAllResources) .ignoredRoutes(Arrays.stream(exclusions).collect(Collectors.toSet()))