Untitled
unknown
plain_text
2 years ago
1.0 kB
10
Indexable
@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();
}Editor is loading...