Skip to content

Commit 695908e

Browse files
author
kimyonghwa
committed
bugfix : exception process
1 parent 758c3a0 commit 695908e

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

‎src/main/java/com/rest/api/config/security/CustomAccessDeniedHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public class CustomAccessDeniedHandler implements AccessDeniedHandler {
2222
@Override
2323
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException exception) throws IOException,
2424
ServletException {
25-
RequestDispatcher dispatcher = request.getRequestDispatcher("/exception/accessdenied");
26-
dispatcher.forward(request, response);
25+
response.sendRedirect("/exception/accessdenied");
2726
}
2827
}

‎src/main/java/com/rest/api/config/security/CustomAuthenticationEntryPoint.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint
1818
@Override
1919
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException ex) throws IOException,
2020
ServletException {
21-
RequestDispatcher dispatcher = request.getRequestDispatcher("/exception/entrypoint");
22-
dispatcher.forward(request, response);
21+
response.sendRedirect("/exception/entrypoint");
2322
}
2423
}

‎src/main/java/com/rest/api/config/security/SecurityConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected void configure(HttpSecurity http) throws Exception {
3232
.and()
3333
.authorizeRequests() // 다음 리퀘스트에 대한 사용권한 체크
3434
.antMatchers("/*/signin", "/*/signup").permitAll() // 가입 및 인증 주소는 누구나 접���가능
35-
.antMatchers(HttpMethod.GET, "/helloworld/**").permitAll() // hellowworld로 시작하는 GET요청 리소스는 누구나 접근가능
35+
.antMatchers(HttpMethod.GET, "/exception/**","/helloworld/**").permitAll() // hellowworld로 시작하는 GET요청 리소스는 누구나 접근가능
3636
.antMatchers("/*/users").hasRole("ADMIN")
3737
.anyRequest().hasRole("USER") // 그외 나머지 요청은 모두 인증된 회원만 접근 가능
3838
.and()

0 commit comments

Comments
 (0)