BasicAuthSwagger

This feature injects basic authentication into the Swagger generator.

Condition:

component.getOption('enableJaxrs').defined and
    component.getOption('jaxrs.auth.basic.enable').defined and
    component.getOption('enableSwagger').defined and
    !component.componentDependencys.{? #this.dependsOn.name.equals("account") }.isEmpty and
    (new net.democritus.expander.rest.helper.RestApplicationApiHelper()).isMainApiComponent(component)
Expander Layer artifact
SwaggerServletExpander CONTROL_LAYER $component.name;format="firstToUpper"$SwaggerServlet.java

Examples of injected Feature Segments

SwaggerServletExpander

@anchor:imports:start
import io.swagger.models.auth.BasicAuthDefinition;
@anchor:imports:end
@anchor:update-security-definitions:start
securityDefinitions.put("basicAuth", new BasicAuthDefinition());
@anchor:update-security-definitions:end
@anchor:update-security:start
security.add(new SecurityRequirement().requirement("basicAuth"));
@anchor:update-security:end