Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: 기수 목록 및 세션 목록 API 권한 허용 #32

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class SecurityConfig {
"/swagger-ui/**",
"/v3/api-docs/**",
"/swagger-ui.html",
"/v1/api/generation",
"/v1/api/session",
"/websocket/csquiz"
};

Expand All @@ -49,7 +51,6 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
AuthenticationManager authenticationManager = sharedObject.build();
http.authenticationManager(authenticationManager);
http.cors();

http.csrf().disable()
.cors().disable()
.formLogin().disable()
Expand All @@ -67,7 +68,6 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.hasAnyRole("MEMBER", "EDUCATION", "ADMIN")
.requestMatchers(new AntPathRequestMatcher("/v1/api/education", "GET")).authenticated()
.requestMatchers("/v1/api/education/**").hasAnyRole("EDUCATION", "ADMIN")
.requestMatchers("/v1/api/generation").authenticated()
.requestMatchers("/v1/api/generation/**").hasAnyRole("ADMIN")
.requestMatchers("/v1/api/mypage/**").hasAnyRole("MEMBER", "OLD_MEMBER", "EDUCATION", "ADMIN")
.requestMatchers("/v1/api/quiz/cs-admin/**").hasAnyRole("EDUCATION", "ADMIN")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ public class JwtAuthorizationFilter extends OncePerRequestFilter {
private static final String LOGIN_PATH = "/login";
private static final String SWAGGER_PATH = "/swagger-ui";
private static final String SWAGGER_PATH_3 = "/v3/api-docs";
private static final String SWAGGER_FAVICON = "/favicon.ico";
private static final String WS = "/websocket/csquiz";
private static final String GENERATION_PATH = "/v1/api/generation";
private static final String SESSION_PATH = "/v1/api/session";

private final JwtTokenProvider jwtTokenProvider;
private final MemberRepository memberRepository;
Expand Down Expand Up @@ -63,7 +66,9 @@ protected boolean shouldNotFilter(HttpServletRequest request) {
String path = request.getRequestURI();
log.info("요청 경로: {}", path);
log.info("요청 메서드: {}", request.getMethod());
return path.startsWith(AUTH_PATH) || path.startsWith(LOGIN_PATH)
|| path.startsWith(SWAGGER_PATH) || path.startsWith(SWAGGER_PATH_3) || path.startsWith(WS);
return path.startsWith(AUTH_PATH) || path.equals(LOGIN_PATH)
|| path.startsWith(SWAGGER_PATH) || path.equals(SWAGGER_FAVICON)
|| path.startsWith(SWAGGER_PATH_3) || path.startsWith(WS)
|| path.equals(GENERATION_PATH) || path.equals(SESSION_PATH);
}
}
Loading