1
resposta

token must not be null

Prezados, boa tarde. Eu add a dependência do openApi porém não consigo logar no swagger pelo browser...

Trace ...

java.lang.NullPointerException: token must not be null

Minha config

fun filterChain(http: HttpSecurity): SecurityFilterChain {
        http.authorizeRequests()
                ?.antMatchers(HttpMethod.GET, "/swagger-ui/*")?.permitAll()
                ?.antMatchers(HttpMethod.GET, "/v3/api-docs/**")?.permitAll()
                ?.antMatchers("/api/topics")?.hasAuthority("READ_WRITE")
                ?.antMatchers(HttpMethod.POST,"/login")?.permitAll()
                ?.anyRequest()
                ?.authenticated()
                ?.and()
                http.addFilterBefore(JWTLoginFilter(authManager = configuration.authenticationManager, jwtUtil = jwtUtil),
                     UsernamePasswordAuthenticationFilter().javaClass)

                http.addFilterBefore(JwtAuthenticationFilter(jwtUtil = jwtUtil),
                        UsernamePasswordAuthenticationFilter().javaClass)
                http.sessionManagement()
                    ?.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                ?.and()
                ?.csrf()?.disable()
                ?.userDetailsService(authorService)

        return http.build()
1 resposta

Bom dia Carlos! Eu estava com problema de 403 ao tentar executar o swagger, achei o seguinte post que pode ajudar: https://stackoverflow.com/questions/75782147/error-403-openapi-with-springboot-security-filter-chain

Com o Spring Boot 3, é um pouco diferente.