본문 바로가기
반응형

분류 전체보기387

Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'loginPersonalController' method 원인 @RequetsMapping 이름이 중복 해결방법 하나 삭제해주면 된다 멍청한 오류였다. 2023. 8. 10.
[SpringSecurity] FailureHandler 구현 1) CustomAuthFailureHandler .java - config파일과 같은 뎁스에 SimpleUrlAuthenticationFailureHandler를 상속한 CustomAuthFailureHandler 생성 - onAuthenticationFailure 오버라이딩 @Component public class CustomAuthFailureHandler extends SimpleUrlAuthenticationFailureHandler { @Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws.. 2023. 8. 2.
Caused by: org.apache.jasper.JasperException: java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.views.index_jsp 원인 security taglib 사용 시JasperException이 발생, tags를 가져오지 못했다고 한다 해결 방법 아래 디펜던시를 추가한다. implementation 'org.springframework.security:spring-security-taglibs' 2023. 8. 1.
[Spring Security] Exception - BadCredentialsException 아이디가 존재하지 않거나, 비밀번호가 틀린 경우 발생하는 exception. (보안을 위해 아이디가 틀린 건지 비밀번호가 틀린 건지 알려주지 않기 위해 둘 다 BadCredentialsException 을 발생 시킨다) 기본은 위 처럼사용하지만 아이디가 틀린 건지 비밀번호가 틀린 건지 알리고 싶으면 AuthenticationProvider 를 커스텀 하여 1) 아이디가 없는 경우에는 UsernameNotFoundException 2) 비밀번호가 틀린 경우에는 BadCredentialsException 을 발생시키 사용 후 AuthenticationFailureHandler 에서 Exception 을 처리해주면 된다 2023. 7. 26.
role should not start with 'ROLE_' since it is automatically inserted. Got 'ROLE_USER' - spring security에서 hasRole() 사용 시 발생 - 오류내용 : Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalArgumentException: role should not start with 'ROLE_' since it is automatically inserted. Got 'ROLE_USER' 원인 - hasRole() 내부 : rolePrefix는 자동으로 .. 2023. 7. 21.
[SpringSecurity] java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null" 원인 SpringSecurity 5버전 이상부터는 PasswordEncoder를 처리를 하는데, 이때 PasswordEncoder를 처리하기위한 형식으로 pw가 저장되어있지 않기때문이다. - 기본이 bcrypt이다. - SpringSecurity가 로그인 과정에서 어떤 Encoder를 쓸지는 database에 저장된 password의 prefix { Encoder명 }를 보고 결정한다. - 따로 설정을하지않았으니, SpringSecurity가 prefix를 보고 Enocder형식을 정해야 하는데, 이것조처 설정이 되어있지 않아서 에러가 난것 해결 방법 securityconfig 에 빈을 등록한다. @Bean public PasswordEncoder noOpPasswordEncoder(){ return N.. 2023. 7. 20.
반응형