5
我已经为我的应用程序中列出的所有控制器设置并使用了Swagger。但是,我希望它能够获得Spring Security Logout端点,并且找不到一种方法来实现它。正如你从下面的代码片段可以看到的,我为用户指定了一个logoutUrl来使其会话无效。我已经尝试了课程级别的注释标记和方法级别,但没有运气。有任何想法吗?配置Swagger-UI来获取Spring的HttpSecurity注销端点
@Override
public void configure(HttpSecurity http) throws Exception {
http.addFilter(someFilter());
http.headers().and().csrf().disable()
.authorizeRequests()
.antMatchers("endpoint",
"endpoint",
"endpoint",
"endpoint",
"endpoint",
"endpoint",
"endpoint").permitAll()
.anyRequest().authenticated()
.and()
.logout().logoutUrl("endpoint/logout").invalidateHttpSession(true).logoutSuccessHandler(logoutSuccessHandler);
}
我扬鞭文案配置低于:
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.apiInfo(new ApiInfo("API",
"Provides API's",
"1.0",
null,
"[email protected].com",
null,
null))
.useDefaultResponseMessages(false)
.pathProvider(new RelativePathProvider(servletContext) {
@Override
protected String applicationPath() {
return super.applicationPath() + "/path";
}
@Override
protected String getDocumentationPath() {
return super.getDocumentationPath() + "/path";
}
});
}