Skip to content

Commit 23a745b

Browse files
authored
Merge pull request #90 from MT-TEAM-Org/PH-111-Member-PK-변경
test : 쿠키가 공유되지 않아 테스트 코드로 변경
2 parents d621f8e + 03a7c8b commit 23a745b

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/main/java/org/myteam/server/global/security/config/SecurityConfig.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,28 @@ public class SecurityConfig {
5050
/* 권한 제외 대상 */
5151
private static final String[] PERMIT_ALL_URLS = new String[]{
5252
// Test Endpoints
53-
/** @brief Exception Test */ "/test/exception-test",
54-
/** @brief Can Access All */ "/test/all/**",
55-
/** @brief Test login, create */ "/api/test/**",
56-
/** @brief Test Slack Integration */ "/test/slack",
53+
/** @brief Exception Test */"/test/exception-test",
54+
/** @brief Can Access All */"/test/all/**",
55+
/** @brief Test login, create */"/api/test/**",
56+
/** @brief Test Slack Integration */"/test/slack",
5757
"/api/members/get-token/**", "/api/attachments/**", "/api/posts/**",
5858

5959
// Chat
6060
"/ws-stomp/**",
6161

6262
// Health Check
63-
/** @brief health check */ "/status",
63+
/** @brief health check */"/status",
6464

6565
// Swagger Documents
66-
/** @brief Swagger Docs */ "/v3/api-docs/**", "/swagger-ui/**",
66+
/** @brief Swagger Docs */"/v3/api-docs/**", "/swagger-ui/**",
6767

6868
// Database console
69-
/** @brief database url */ "/h2-console",
69+
/** @brief database url */"/h2-console",
7070

7171
// Business Logic
72-
/** @brief about login */ "/auth/**",
73-
/** @brief Allow static resource access */ "/upload/**",
74-
/** @brief Allow user permission to change */ "/api/members/role",
72+
/** @brief about login */"/auth/**",
73+
/** @brief Allow static resource access */"/upload/**",
74+
/** @brief Allow user permission to change */"/api/members/role",
7575
"/api/certification/send",
7676
"/api/certification/certify-code",
7777
"/api/oauth2/members/email/**",
@@ -82,14 +82,14 @@ public class SecurityConfig {
8282
/* Admin 접근 권한 */
8383
private static final String[] PERMIT_ADMIN_URLS = new String[]{
8484
// Test Endpoints
85-
/** @brief Check Access Admin */ "/test/admin/**",
85+
/** @brief Check Access Admin */"/test/admin/**",
8686

8787
"/api/admin/**",
8888
};
8989
/* member 접근 권한 */
9090
private static final String[] PERMIT_MEMBER_URLS = new String[]{
9191
// Test Endpoints
92-
/** @brief Check Access Member */ "/test/cert",
92+
/** @brief Check Access Member */"/test/cert",
9393
};
9494

9595
@Value("${FRONT_URL:http://localhost:3000}")
@@ -149,7 +149,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
149149
.addFilter(webConfig.corsFilter()); // CORS 필터 추가
150150

151151
// // cors 설정
152-
// http.cors((corsCustomizer) -> corsCustomizer.configurationSource(configurationSource()));
152+
http.cors((corsCustomizer) -> corsCustomizer.configurationSource(configurationSource()));
153153

154154
// 예외 처리 핸들러 설정
155155
http.exceptionHandling(exceptionHandling -> exceptionHandling
@@ -167,16 +167,16 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
167167

168168
// 경로별 인가 작업
169169
http.authorizeHttpRequests(authorizeRequests ->
170-
authorizeRequests
171-
.requestMatchers(PERMIT_ALL_URLS).permitAll()
172-
.requestMatchers(PERMIT_ADMIN_URLS).hasAnyAuthority(MemberRole.ADMIN.name())
173-
.requestMatchers(HttpMethod.GET, "/api/categories/**").permitAll()
174-
.requestMatchers(HttpMethod.PUT, "/api/categories/**").hasAnyAuthority(MemberRole.ADMIN.name())
175-
.requestMatchers(HttpMethod.DELETE, "/api/categories/**").hasAnyAuthority(MemberRole.ADMIN.name())
176-
.requestMatchers(HttpMethod.POST, "/api/categories").hasAnyAuthority(MemberRole.ADMIN.name())
177-
178-
.anyRequest().authenticated() // 나머지 요청은 모두 허용
179-
);
170+
authorizeRequests
171+
.requestMatchers(PERMIT_ALL_URLS).permitAll()
172+
.requestMatchers(PERMIT_ADMIN_URLS).hasAnyAuthority(MemberRole.ADMIN.name())
173+
.requestMatchers(HttpMethod.GET, "/api/categories/**").permitAll()
174+
.requestMatchers(HttpMethod.PUT, "/api/categories/**").hasAnyAuthority(MemberRole.ADMIN.name())
175+
.requestMatchers(HttpMethod.DELETE, "/api/categories/**").hasAnyAuthority(MemberRole.ADMIN.name())
176+
.requestMatchers(HttpMethod.POST, "/api/categories").hasAnyAuthority(MemberRole.ADMIN.name())
177+
178+
.anyRequest().authenticated() // 나머지 요청은 모두 허용
179+
);
180180

181181
return http.build();
182182
}

0 commit comments

Comments
 (0)