Skip to content

Commit 62d0da3

Browse files
author
Steve Riesenberg
committed
1 parent 232b3b7 commit 62d0da3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/JdbcOAuth2AuthorizationService.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.Set;
3030
import java.util.function.Function;
3131

32+
import com.fasterxml.jackson.core.type.TypeReference;
3233
import com.fasterxml.jackson.databind.Module;
3334
import com.fasterxml.jackson.databind.ObjectMapper;
3435

@@ -254,9 +255,13 @@ public OAuth2Authorization findByToken(String token, @Nullable OAuth2TokenType t
254255
return null;
255256
}
256257

257-
private OAuth2Authorization findBy(String filter, List<SqlParameterValue> parameters) {
258+
protected final List<OAuth2Authorization> findAll(String filter, List<SqlParameterValue> parameters) {
258259
PreparedStatementSetter pss = new ArgumentPreparedStatementSetter(parameters.toArray());
259-
List<OAuth2Authorization> result = this.jdbcOperations.query(LOAD_AUTHORIZATION_SQL + filter, pss, this.authorizationRowMapper);
260+
return this.jdbcOperations.query(LOAD_AUTHORIZATION_SQL + filter, pss, this.authorizationRowMapper);
261+
}
262+
263+
protected final OAuth2Authorization findBy(String filter, List<SqlParameterValue> parameters) {
264+
List<OAuth2Authorization> result = findAll(filter, parameters);
260265
return !result.isEmpty() ? result.get(0) : null;
261266
}
262267

@@ -436,10 +441,9 @@ protected final ObjectMapper getObjectMapper() {
436441
return this.objectMapper;
437442
}
438443

439-
@SuppressWarnings("unchecked")
440444
private Map<String, Object> parseMap(String data) {
441445
try {
442-
return this.objectMapper.readValue(data, Map.class);
446+
return this.objectMapper.readValue(data, new TypeReference<Map<String, Object>>() {});
443447
} catch (Exception ex) {
444448
throw new IllegalArgumentException(ex.getMessage(), ex);
445449
}
@@ -542,7 +546,6 @@ private <T extends AbstractOAuth2Token> List<SqlParameterValue> toSqlParameterLi
542546
return parameters;
543547
}
544548

545-
@SuppressWarnings("unchecked")
546549
private String writeMap(Map<String, Object> data) {
547550
try {
548551
return this.objectMapper.writeValueAsString(data);

0 commit comments

Comments
 (0)