Spring Security与Swagger的交互

我有一个使用spring安全性的应用程序后端,出于文档目的,我使用了swagger。 由于某种原因,此配置无法正常工作。访问任何与之相关的动作时,它都会显示401。

这是我的安全配置:

n = int(input("enter a number: "))
x = n
y = n
for i in range(2,n):
    while n % i  == 0:
            x += 1
            y -= 1
            if n % i != 0 and (x-n) < (n-y):
                print("The prime number closest to",n,"is",x)
            elif n % i != 0 and (n-y) < (x-n):
                print ("The prime number closest to",y)
    else:
            print ("The prime number closest to",n)  

这是我的招摇配置:

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.csrf().disable()
        .authorizeRequests()
        .antMatchers("/v2/**","/webjars/**","/swagger-resources/**","/swagger-ui.html").permitAll()
        .antMatchers(HttpMethod.POST,"/login").permitAll()
        .antMatchers(HttpMethod.POST,"/signup").permitAll()
        .anyRequest().authenticated()
        .and()
        .addFilterBefore(new UserPasswordauthenticationFilterToJWT("/login",super.authenticationmanager()),BasicAuthenticationFilter.class)
        .addFilterBefore(new UserPasswordSignUpFilterToJWT("/signup",users),BasicAuthenticationFilter.class)
        .addFilterBefore(new JWTAuthenticationFilter(),BasicAuthenticationFilter.class);
}

这里没有什么工作?我似乎无法弄清楚

zhaowei19790715 回答:Spring Security与Swagger的交互

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3162914.html

大家都在问