私はspring-bootでうまくいくUIを持っています。私はすべてのAPIパスの役割に基づいて制限されている私の春の残りのAPIのためのステートレスな認証設定を持っています。Swager UIへのアクセスを制限する
はしかし、私は私が基本認証の後ろに<server_url>/swagger-ui.html
を置くことができるかどうかはわかりませんよ。私はあなたの設定についての詳細を知らなくてもWebSecurityConfig
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
.csrf().disable()
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.authorizeRequests()
.antMatchers("/sysadmin/**").hasRole("SYSADMIN")
.antMatchers("/admin/**").hasRole("ADMIN")
.antMatchers("/siteadmin/**").hasRole("SITEADMIN")
.antMatchers("/api/**").hasRole("USER")
.anyRequest().permitAll();
// Custom JWT based security filter
httpSecurity
.addFilterBefore(authenticationTokenFilterBean(), UsernamePasswordAuthenticationFilter.class);
}
を追加できるように、パスの下に闊歩ファイルを置くことです。それを行うにはいくつかの方法がありますが、あなたの実現についてもっと知ることは助けになります。 –
更新された私の質問 –