Skip to content

Commit

Permalink
[Fix] :: SecurityConfig fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lgwk42 committed May 22, 2024
1 parent 0d34ce2 commit e55f9de
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.requestMatchers("/terms/**").permitAll()
.requestMatchers("/auth/**").permitAll()
.requestMatchers(POST,"/attendance/code").permitAll()
.requestMatchers(DELETE,"/user").permitAll()

.requestMatchers("/outing-admin/**").hasAnyAuthority(ADMIN,TEACHER)
.requestMatchers("/sleepover-admin/**").hasAnyAuthority(ADMIN,TEACHER)
.requestMatchers(GET,"/attendance/check").hasAnyAuthority(ADMIN,TEACHER)
.requestMatchers(GET,"/attendance/non-check").hasAnyAuthority(ADMIN,TEACHER)
.requestMatchers("/sleepover-admin/**").hasAnyAuthority(ADMIN,TEACHER)
.requestMatchers(GET,"/user-admin/find-all").hasAnyAuthority(ADMIN,TEACHER)
.requestMatchers(GET,"/user-admin/search").hasAnyAuthority(ADMIN,TEACHER)

Expand All @@ -58,15 +59,14 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.requestMatchers(PATCH,"/user/room").hasAuthority(USER)

.requestMatchers("/school/**").hasAuthority(ADMIN)
.requestMatchers(GET,"/user-admin/await-user").hasAuthority(ADMIN)
.requestMatchers(PATCH,"/user-admin/approve").hasAuthority(ADMIN)
.requestMatchers(PATCH,"/user-admin/reject").hasAuthority(ADMIN)
.requestMatchers(GET,"/user-admin/await-user").hasAuthority(ADMIN)

.anyRequest().authenticated()
)
.addFilterAfter(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class);

return http.build();
}

Expand All @@ -78,15 +78,12 @@ public PasswordEncoder passwordEncoder() {
@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();

configuration.addAllowedOriginPattern("*");
configuration.addAllowedHeader("*");
configuration.addAllowedMethod("*");
configuration.setAllowCredentials(true);

UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);

return source;
}

Expand Down

0 comments on commit e55f9de

Please sign in to comment.