You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2020/02/25 11:25:09 UTC

[cxf] 02/02: cxf-rt-rs-security-oauth2: clone List

This is an automated email from the ASF dual-hosted git repository.

buhhunyx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 07a8053b1ff92a1d8c59f51098b691c65d23eed3
Author: Alexey Markevich <bu...@gmail.com>
AuthorDate: Tue Feb 25 14:24:31 2020 +0300

    cxf-rt-rs-security-oauth2: clone List
---
 .../rs/security/oauth2/provider/AbstractOAuthDataProvider.java   | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
index 3681b86..dd6d20b 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
@@ -21,7 +21,6 @@ package org.apache.cxf.rs.security.oauth2.provider;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -372,15 +371,11 @@ public abstract class AbstractOAuthDataProvider implements OAuthDataProvider, Cl
     protected RefreshToken doCreateNewRefreshToken(ServerAccessToken at) {
         RefreshToken rt = new RefreshToken(at.getClient(), refreshTokenLifetime);
         if (at.getAudiences() != null) {
-            List<String> audiences = new LinkedList<>();
-            audiences.addAll(at.getAudiences());
-            rt.setAudiences(audiences);
+            rt.setAudiences(new ArrayList<>(at.getAudiences()));
         }
         rt.setGrantType(at.getGrantType());
         if (at.getScopes() != null) {
-            List<OAuthPermission> scopes = new LinkedList<>();
-            scopes.addAll(at.getScopes());
-            rt.setScopes(scopes);
+            rt.setScopes(new ArrayList<>(at.getScopes()));
         }
         rt.setGrantCode(at.getGrantCode());
         rt.setNonce(at.getNonce());