You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/07/19 13:50:04 UTC
[cxf] 01/02: CXF-7803 - JCache OAuthDataProvider implementation
doesn't work with refresh tokens
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 67699e7f4c79fe101155349223a61205cfb74ef3
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Thu Jul 19 10:38:49 2018 +0100
CXF-7803 - JCache OAuthDataProvider implementation doesn't work with refresh tokens
(cherry picked from commit 80e99a279d293958a39eb025af1701176b18c1ef)
(cherry picked from commit df82763af06f5f9e8ef5939782ee3099093bb1a4)
---
.../cxf/rs/security/oauth2/provider/JCacheOAuthDataProvider.java | 6 ++++++
.../rs/security/oauth2/provider/JCacheOAuthDataProviderTest.java | 6 ++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProvider.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProvider.java
index ebc1689..8933561 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProvider.java
@@ -182,6 +182,12 @@ public class JCacheOAuthDataProvider extends AbstractOAuthDataProvider {
}
@Override
+ protected void linkRefreshTokenToAccessToken(RefreshToken rt, ServerAccessToken at) {
+ super.linkRefreshTokenToAccessToken(rt, at);
+ accessTokenCache.replace(at.getTokenKey(), at);
+ }
+
+ @Override
public void close() {
clientCache.close();
diff --git a/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProviderTest.java b/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProviderTest.java
index 6d413f3..f2de793 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProviderTest.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/JCacheOAuthDataProviderTest.java
@@ -33,7 +33,6 @@ import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
public class JCacheOAuthDataProviderTest extends Assert {
@@ -42,6 +41,8 @@ public class JCacheOAuthDataProviderTest extends Assert {
@Before
public void setUp() throws Exception {
provider = new JCacheOAuthDataProvider();
+ provider.setSupportedScopes(Collections.singletonMap("a", "A Scope"));
+ provider.setSupportedScopes(Collections.singletonMap("refreshToken", "RefreshToken"));
}
@Test
@@ -91,7 +92,6 @@ public class JCacheOAuthDataProviderTest extends Assert {
assertEquals(0, allClients.size());
}
- @Ignore
@Test
public void testAddGetDeleteAccessToken() {
Client c = addClient("101", "bob");
@@ -134,7 +134,6 @@ public class JCacheOAuthDataProviderTest extends Assert {
assertNull(provider.getAccessToken(at.getTokenKey()));
}
- @Ignore
@Test
public void testAddGetDeleteAccessToken2() {
Client c = addClient("102", "bob");
@@ -156,7 +155,6 @@ public class JCacheOAuthDataProviderTest extends Assert {
assertEquals(0, tokens.size());
}
- @Ignore
@Test
public void testAddGetDeleteRefreshToken() {
Client c = addClient("101", "bob");