프로젝트 정리/경조사 가계부 프로젝트

7. SpringSecurity persistent_login 에러

현재 SpringSecurity, Mysql로 작업 중

SpringSecurity의 로그인 기능을 사용하던 중 아래와 같은 내용의 에러가 발생했다.

더보기

org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [select username,series,token,last_used from persistent_logins where series = ?]; nested exception is java.sql.SQLSyntaxErrorException: Table 'familyevents.persistent_logins' doesn't exist

 

SQL 문법 에러인데 이유는 persistent_logins 라는 테이블이 존재하지 않기 때문이라고 한다.

 

remember-me 기능을 사용하다가 발생한 에러 같기도 하다.

 

https://docs.spring.io/spring-security/site/docs/3.0.x/reference/remember-me.html

 

10. Remember-Me Authentication

Remember-me authentication is not used with basic authentication, given it is often not used with HttpSessions. Remember-me is used with UsernamePasswordAuthenticationFilter, and is implemented via hooks in the AbstractAuthenticationProcessingFilter superc

docs.spring.io

 

그래서 아래 글을 참조하여 테이블을 생성해 주었다.

https://mkyong.com/spring-security/spring-security-remember-me-example/

 

Spring Security Remember Me Example - Mkyong.com

- Spring Security Remember Me Example

mkyong.com

 

CREATE TABLE persistent_logins (
    username varchar(64) not null,
    series varchar(64) not null,
    token varchar(64) not null,
    last_used timestamp not null,
    PRIMARY KEY (series)
);

 

 

에러 해결!