updated code for PreAuthorize role
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package net.gepafin.tendermanagement.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -17,12 +15,10 @@ import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.access.intercept.AuthorizationFilter;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.handler.HandlerMappingIntrospector;
|
||||
@@ -71,18 +67,6 @@ public class SecurityConfig {
|
||||
.requestMatchers(new AntPathRequestMatcher("/swagger-ui/**"));
|
||||
}
|
||||
|
||||
|
||||
// @Bean
|
||||
// public CorsFilter corsFilter() {
|
||||
// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
// CorsConfiguration config = new CorsConfiguration();
|
||||
// config.setAllowCredentials(true);
|
||||
// config.addAllowedOrigin("http://localhost:3000");
|
||||
// config.addAllowedMethod("*");
|
||||
// config.addAllowedHeader("*");
|
||||
// source.registerCorsConfiguration("/**", config);
|
||||
// return new CorsFilter(source);
|
||||
// }
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
@@ -109,7 +93,6 @@ public class SecurityConfig {
|
||||
.csrf(AbstractHttpConfigurer::disable)
|
||||
.authorizeHttpRequests(auth -> auth
|
||||
.requestMatchers(mvc.pattern(HttpMethod.POST, "/v1/user/login")).permitAll()
|
||||
.requestMatchers(mvc.pattern(HttpMethod.POST, "/v1/user")).permitAll()
|
||||
.requestMatchers("/swagger-ui/**").permitAll()
|
||||
.requestMatchers("/v1/api-docs/**").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
|
||||
Reference in New Issue
Block a user