Class JdbcTokenRepositoryImpl
- java.lang.Object
-
- org.springframework.dao.support.DaoSupport
-
- org.springframework.jdbc.core.support.JdbcDaoSupport
-
- org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean,PersistentTokenRepository
public class JdbcTokenRepositoryImpl extends org.springframework.jdbc.core.support.JdbcDaoSupport implements PersistentTokenRepository
JDBC based persistent login token repository implementation.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCREATE_TABLE_SQLDefault SQL for creating the database table to store the tokensstatic java.lang.StringDEF_INSERT_TOKEN_SQLThe default SQL used by createNewTokenstatic java.lang.StringDEF_REMOVE_USER_TOKENS_SQLThe default SQL used by removeUserTokensstatic java.lang.StringDEF_TOKEN_BY_SERIES_SQLThe default SQL used by the getTokenBySeries querystatic java.lang.StringDEF_UPDATE_TOKEN_SQLThe default SQL used by updateToken
-
Constructor Summary
Constructors Constructor Description JdbcTokenRepositoryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateNewToken(PersistentRememberMeToken token)PersistentRememberMeTokengetTokenForSeries(java.lang.String seriesId)Loads the token data for the supplied series identifier.protected voidinitDao()voidremoveUserTokens(java.lang.String username)voidsetCreateTableOnStartup(boolean createTableOnStartup)Intended for convenience in debugging.voidupdateToken(java.lang.String series, java.lang.String tokenValue, java.util.Date lastUsed)
-
-
-
Field Detail
-
CREATE_TABLE_SQL
public static final java.lang.String CREATE_TABLE_SQL
Default SQL for creating the database table to store the tokens- See Also:
- Constant Field Values
-
DEF_TOKEN_BY_SERIES_SQL
public static final java.lang.String DEF_TOKEN_BY_SERIES_SQL
The default SQL used by the getTokenBySeries query- See Also:
- Constant Field Values
-
DEF_INSERT_TOKEN_SQL
public static final java.lang.String DEF_INSERT_TOKEN_SQL
The default SQL used by createNewToken- See Also:
- Constant Field Values
-
DEF_UPDATE_TOKEN_SQL
public static final java.lang.String DEF_UPDATE_TOKEN_SQL
The default SQL used by updateToken- See Also:
- Constant Field Values
-
DEF_REMOVE_USER_TOKENS_SQL
public static final java.lang.String DEF_REMOVE_USER_TOKENS_SQL
The default SQL used by removeUserTokens- See Also:
- Constant Field Values
-
-
Method Detail
-
initDao
protected void initDao()
- Overrides:
initDaoin classorg.springframework.dao.support.DaoSupport
-
createNewToken
public void createNewToken(PersistentRememberMeToken token)
- Specified by:
createNewTokenin interfacePersistentTokenRepository
-
updateToken
public void updateToken(java.lang.String series, java.lang.String tokenValue, java.util.Date lastUsed)- Specified by:
updateTokenin interfacePersistentTokenRepository
-
getTokenForSeries
public PersistentRememberMeToken getTokenForSeries(java.lang.String seriesId)
Loads the token data for the supplied series identifier. If an error occurs, it will be reported and null will be returned (since the result should just be a failed persistent login).- Specified by:
getTokenForSeriesin interfacePersistentTokenRepository- Parameters:
seriesId-- Returns:
- the token matching the series, or null if no match found or an exception occurred.
-
removeUserTokens
public void removeUserTokens(java.lang.String username)
- Specified by:
removeUserTokensin interfacePersistentTokenRepository
-
setCreateTableOnStartup
public void setCreateTableOnStartup(boolean createTableOnStartup)
Intended for convenience in debugging. Will create the persistent_tokens database table when the class is initialized during the initDao method.- Parameters:
createTableOnStartup- set to true to execute the
-
-