|
@@ -29,7 +29,6 @@ import java.util.Set;
|
|
|
import java.util.function.Function;
|
|
|
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import org.junit.After;
|
|
|
import org.junit.Before;
|
|
|
import org.junit.Test;
|
|
@@ -210,7 +209,7 @@ public class JdbcOAuth2AuthorizationServiceTests {
|
|
|
.authorizationGrantType(AUTHORIZATION_GRANT_TYPE)
|
|
|
.token(AUTHORIZATION_CODE)
|
|
|
.build();
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+
|
|
|
RowMapper<OAuth2Authorization> authorizationRowMapper = spy(
|
|
|
new JdbcOAuth2AuthorizationService.OAuth2AuthorizationRowMapper(
|
|
|
this.registeredClientRepository));
|
|
@@ -252,7 +251,7 @@ public class JdbcOAuth2AuthorizationServiceTests {
|
|
|
AUTHORIZATION_CODE.getTokenValue(), AUTHORIZATION_CODE_TOKEN_TYPE);
|
|
|
assertThat(authorization).isEqualTo(expectedAuthorization);
|
|
|
|
|
|
- this.authorizationService.remove(expectedAuthorization);
|
|
|
+ this.authorizationService.remove(authorization);
|
|
|
authorization = this.authorizationService.findByToken(
|
|
|
AUTHORIZATION_CODE.getTokenValue(), AUTHORIZATION_CODE_TOKEN_TYPE);
|
|
|
assertThat(authorization).isNull();
|
|
@@ -463,8 +462,7 @@ public class JdbcOAuth2AuthorizationServiceTests {
|
|
|
|
|
|
private static final String PK_FILTER = "id = ?";
|
|
|
private static final String UNKNOWN_TOKEN_TYPE_FILTER = "state = ? OR authorizationCodeValue = ? OR " +
|
|
|
- "accessTokenValue = ? OR " +
|
|
|
- "refreshTokenValue = ?";
|
|
|
+ "accessTokenValue = ? OR refreshTokenValue = ?";
|
|
|
|
|
|
// @formatter:off
|
|
|
private static final String LOAD_AUTHORIZATION_SQL = "SELECT " + COLUMN_NAMES
|
|
@@ -474,12 +472,12 @@ public class JdbcOAuth2AuthorizationServiceTests {
|
|
|
|
|
|
// @formatter:off
|
|
|
private static final String SAVE_AUTHORIZATION_SQL = "INSERT INTO " + TABLE_NAME
|
|
|
- + " (" + COLUMN_NAMES + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?)";
|
|
|
+ + " (" + COLUMN_NAMES + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
|
// @formatter:on
|
|
|
|
|
|
private static final String REMOVE_AUTHORIZATION_SQL = "DELETE FROM " + TABLE_NAME + " WHERE " + PK_FILTER;
|
|
|
|
|
|
- CustomJdbcOAuth2AuthorizationService(JdbcOperations jdbcOperations,
|
|
|
+ private CustomJdbcOAuth2AuthorizationService(JdbcOperations jdbcOperations,
|
|
|
RegisteredClientRepository registeredClientRepository) {
|
|
|
super(jdbcOperations, registeredClientRepository);
|
|
|
setAuthorizationRowMapper(new CustomOAuth2AuthorizationRowMapper(registeredClientRepository));
|
|
@@ -520,7 +518,7 @@ public class JdbcOAuth2AuthorizationServiceTests {
|
|
|
|
|
|
private static final class CustomOAuth2AuthorizationRowMapper extends JdbcOAuth2AuthorizationService.OAuth2AuthorizationRowMapper {
|
|
|
|
|
|
- CustomOAuth2AuthorizationRowMapper(RegisteredClientRepository registeredClientRepository) {
|
|
|
+ private CustomOAuth2AuthorizationRowMapper(RegisteredClientRepository registeredClientRepository) {
|
|
|
super(registeredClientRepository);
|
|
|
}
|
|
|
|
|
@@ -682,7 +680,6 @@ public class JdbcOAuth2AuthorizationServiceTests {
|
|
|
if (token.getToken().getIssuedAt() != null) {
|
|
|
tokenIssuedAt = Timestamp.from(token.getToken().getIssuedAt());
|
|
|
}
|
|
|
-
|
|
|
if (token.getToken().getExpiresAt() != null) {
|
|
|
tokenExpiresAt = Timestamp.from(token.getToken().getExpiresAt());
|
|
|
}
|