Untitled
unknown
plain_text
a year ago
1.0 kB
1
Indexable
Never
@Bean SecurityFilterChain filterChain(HttpSecurity http, AuthenticationManager authManager) throws Exception { JWTAuthenticationFilter jwtAuthenticationFilter = new JWTAuthenticationFilter(); jwtAuthenticationFilter.setAuthenticationManager(authManager); jwtAuthenticationFilter.setFilterProcessesUrl("/login"); return http .csrf().disable() .authorizeRequests() .antMatchers("/register").permitAll()//cualquiera puede ingresar a /register .antMatchers("/swagger-ui/**").permitAll() .anyRequest().authenticated() .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .addFilter(jwtAuthenticationFilter) .addFilterBefore(jwtAuthorizationFilter, UsernamePasswordAuthenticationFilter.class) .build(); }