|
|
@@ -13,6 +13,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.sql.DataSource;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author Yuuki
|
|
|
@@ -54,7 +56,12 @@ public class RedisClientDetailsService extends JdbcClientDetailsService {
|
|
|
ClientDetails clientDetails = null;
|
|
|
clientDetails = super.loadClientByClientId(clientId);
|
|
|
if (clientDetails != null) {
|
|
|
- redisService.hset(CACHE_CLIENT_KEY, clientId, JSONObject.toJSONString(clientDetails));
|
|
|
+ BaseClientDetails baseClientDetails = (BaseClientDetails) clientDetails;
|
|
|
+ Set<String> autoApproveScopes = baseClientDetails.getAutoApproveScopes();
|
|
|
+ baseClientDetails.setAutoApproveScopes(
|
|
|
+ autoApproveScopes.stream().map(this::convert).collect(Collectors.toSet())
|
|
|
+ );
|
|
|
+ redisService.hset(CACHE_CLIENT_KEY, clientId, JSONObject.toJSONString(baseClientDetails));
|
|
|
}
|
|
|
return clientDetails;
|
|
|
}
|
|
|
@@ -84,4 +91,9 @@ public class RedisClientDetailsService extends JdbcClientDetailsService {
|
|
|
}
|
|
|
list.forEach(client -> redisService.hset(CACHE_CLIENT_KEY, client.getClientId(), JSONObject.toJSONString(client)));
|
|
|
}
|
|
|
+
|
|
|
+ private String convert(String value) {
|
|
|
+ final String logicTrue = "1";
|
|
|
+ return logicTrue.equals(value) ? Boolean.TRUE.toString() : Boolean.FALSE.toString();
|
|
|
+ }
|
|
|
}
|