@Test public void saveAccessToken() { AccessToken accessToken = new AccessToken() .username("user") .authenticationId("auted") .clientId("client"); final int i = oauthJdbcRepository.saveAccessToken(accessToken); assertEquals(i, 1); }
@Override public int saveAccessToken(final AccessToken accessToken) { final String sql = "insert into oauth_access_token(token_id,token_expired_seconds,authentication_id," + "username,client_id,token_type,refresh_token_expired_seconds,refresh_token) values (?,?,?,?,?,?,?,?) "; return jdbcTemplate.update(sql, new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, accessToken.tokenId()); ps.setInt(2, accessToken.tokenExpiredSeconds()); ps.setString(3, accessToken.authenticationId()); ps.setString(4, accessToken.username()); ps.setString(5, accessToken.clientId()); ps.setString(6, accessToken.tokenType()); ps.setInt(7, accessToken.refreshTokenExpiredSeconds()); ps.setString(8, accessToken.refreshToken()); } }); }
OauthJdbcRepository extends AbstractJdbcRepository implements OauthRepository { @Override public int saveAccessToken(final AccessToken accessToken) { final String sql = "insert into oauth_access_token(token_id,token_expired_seconds,authentication_id," + "username,client_id,token_type,refresh_token_expired_seconds,refresh_token) values (?,?,?,?,?,?,?,?) "; return jdbcTemplate.update(sql, new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, accessToken.tokenId()); ps.setInt(2, accessToken.tokenExpiredSeconds()); ps.setString(3, accessToken.authenticationId()); ps.setString(4, accessToken.username()); ps.setString(5, accessToken.clientId()); ps.setString(6, accessToken.tokenType()); ps.setInt(7, accessToken.refreshTokenExpiredSeconds()); ps.setString(8, accessToken.refreshToken()); } }); } }
OauthJdbcRepository extends AbstractJdbcRepository implements OauthRepository { @Override public int saveAccessToken(final AccessToken accessToken) { final String sql = "insert into oauth_access_token(token_id,token_expired_seconds,authentication_id," + "username,client_id,token_type,refresh_token_expired_seconds,refresh_token) values (?,?,?,?,?,?,?,?) "; return jdbcTemplate.update(sql, new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, accessToken.tokenId()); ps.setInt(2, accessToken.tokenExpiredSeconds()); ps.setString(3, accessToken.authenticationId()); ps.setString(4, accessToken.username()); ps.setString(5, accessToken.clientId()); ps.setString(6, accessToken.tokenType()); ps.setInt(7, accessToken.refreshTokenExpiredSeconds()); ps.setString(8, accessToken.refreshToken()); } }); }  }
OauthJdbcRepository extends AbstractJdbcRepository implements OauthRepository { @Override public int saveAccessToken(final AccessToken accessToken) { final String sql = "insert into oauth_access_token(token_id,token_expired_seconds,authentication_id," + "username,client_id,token_type,refresh_token_expired_seconds,refresh_token) values (?,?,?,?,?,?,?,?) "; return jdbcTemplate.update(sql, new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, accessToken.tokenId()); ps.setInt(2, accessToken.tokenExpiredSeconds()); ps.setString(3, accessToken.authenticationId()); ps.setString(4, accessToken.username()); ps.setString(5, accessToken.clientId()); ps.setString(6, accessToken.tokenType()); ps.setInt(7, accessToken.refreshTokenExpiredSeconds()); ps.setString(8, accessToken.refreshToken()); } }); }  @Override ClientDetails findClientDetails(String clientId); @Override int saveClientDetails(final ClientDetails clientDetails); @Override int saveOauthCode(final OauthCode oauthCode); @Override OauthCode findOauthCode(String code, String clientId); @Override OauthCode findOauthCodeByUsernameClientId(String username, String clientId); @Override int deleteOauthCode(final OauthCode oauthCode); @Override AccessToken findAccessToken(String clientId, String username, String authenticationId); @Override int deleteAccessToken(final AccessToken accessToken); @Override int saveAccessToken(final AccessToken accessToken); @Override AccessToken findAccessTokenByRefreshToken(String refreshToken, String clientId); }
OauthJdbcRepository extends AbstractJdbcRepository implements OauthRepository { @Override public int saveAccessToken(final AccessToken accessToken) { final String sql = "insert into oauth_access_token(token_id,token_expired_seconds,authentication_id," + "username,client_id,token_type,refresh_token_expired_seconds,refresh_token) values (?,?,?,?,?,?,?,?) "; return jdbcTemplate.update(sql, new PreparedStatementSetter() { @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, accessToken.tokenId()); ps.setInt(2, accessToken.tokenExpiredSeconds()); ps.setString(3, accessToken.authenticationId()); ps.setString(4, accessToken.username()); ps.setString(5, accessToken.clientId()); ps.setString(6, accessToken.tokenType()); ps.setInt(7, accessToken.refreshTokenExpiredSeconds()); ps.setString(8, accessToken.refreshToken()); } }); }  @Override ClientDetails findClientDetails(String clientId); @Override int saveClientDetails(final ClientDetails clientDetails); @Override int saveOauthCode(final OauthCode oauthCode); @Override OauthCode findOauthCode(String code, String clientId); @Override OauthCode findOauthCodeByUsernameClientId(String username, String clientId); @Override int deleteOauthCode(final OauthCode oauthCode); @Override AccessToken findAccessToken(String clientId, String username, String authenticationId); @Override int deleteAccessToken(final AccessToken accessToken); @Override int saveAccessToken(final AccessToken accessToken); @Override AccessToken findAccessTokenByRefreshToken(String refreshToken, String clientId);  }