如何向Swagger添加Spring Security身份验证?

时间:2017-04-12 08:29:30

标签: spring-security annotations swagger swagger-ui swagger-2.0

如何使用注释向Swagger 添加Spring Security身份验证?

我的SwaggerConfig就像:

private ApiInfo apiInfo() {
    return new ApiInfoBuilder().title("Spring REST Sample with Swagger")
            .description("Spring REST Sample with Swagger").license("Apache License Version 2.0").version("1.0")
            .build();
}

@Bean
public Docket docket() {
    Docket docket = new Docket(DocumentationType.SWAGGER_2);
    docket.protocols(new HashSet<String>(Arrays.asList("http")));
    docket.apiInfo(apiInfo()).select()
            .apis(RequestHandlerSelectors.basePackage("com.zycus.endpoint"))
            .paths(PathSelectors.any()).build();
    return docket;
}

0 个答案:

没有答案