본문 바로가기

카테고리 없음

[ Spring Boot] Security Error - Pre-authenticated entry point called. Rejecting access

반응형

소개

해당 경로에 접근할 수 없을때 나는 에러이다.

해결법

requestMatchers에 해당 경로를 접근 허용해주면 된다.

private static final String[] AUTH_WHITELIST = {
    "/login",
    "/user/**",
    "/js/**",
    "/css/**",
    "/html/**",
    "/fonts/**",
    "/images/**",
    "/index.html",
    "/error",
 };

.requestMatchers(AUTH_WHITELIST)
          .permitAll()

생각보다 간단한 문제였지만
/login 경로에 접근을 하면 classpath 경로에 있는 index.html 같은 파일들은 다른 경로라 인식을 하기 때문에 이걸 찾는데 삽질을 좀 했다.

다들 해결 잘 하시길 바랍니다!

반응형