cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6559] Avoiding NPE in AbstractOAuthDataProvider.refreshAccessToken
Date Wed, 26 Aug 2015 11:10:04 GMT
Repository: cxf
Updated Branches:
  refs/heads/master abcffd064 -> 5cf43ce7b


[CXF-6559] Avoiding NPE in AbstractOAuthDataProvider.refreshAccessToken


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5cf43ce7
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5cf43ce7
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5cf43ce7

Branch: refs/heads/master
Commit: 5cf43ce7bebe7cccbbb75e6ef2c8421eb6838b2f
Parents: abcffd0
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Aug 26 12:09:48 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Aug 26 12:09:48 2015 +0100

----------------------------------------------------------------------
 .../rs/security/oauth2/provider/AbstractOAuthDataProvider.java | 5 ++++-
 .../oauth2/provider/DefaultEncryptingOAuthDataProvider.java    | 6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5cf43ce7/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
----------------------------------------------------------------------
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 20a4774..accd4af 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
@@ -51,7 +51,10 @@ public abstract class AbstractOAuthDataProvider implements OAuthDataProvider
{
     @Override
     public ServerAccessToken refreshAccessToken(Client client, String refreshTokenKey,
                                                 List<String> restrictedScopes) throws
OAuthServiceException {
-        RefreshToken oldRefreshToken = revokeRefreshAndAccessTokens(client, refreshTokenKey);

+        RefreshToken oldRefreshToken = revokeRefreshAndAccessTokens(client, refreshTokenKey);
+        if (oldRefreshToken == null) {
+            throw new OAuthServiceException(OAuthConstants.ACCESS_DENIED);
+        }
         return doRefreshAccessToken(client, oldRefreshToken, restrictedScopes);
         
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/5cf43ce7/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/DefaultEncryptingOAuthDataProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/DefaultEncryptingOAuthDataProvider.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/DefaultEncryptingOAuthDataProvider.java
index eae9120..d033b1f 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/DefaultEncryptingOAuthDataProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/DefaultEncryptingOAuthDataProvider.java
@@ -109,7 +109,11 @@ public class DefaultEncryptingOAuthDataProvider extends AbstractOAuthDataProvide
     @Override
     protected RefreshToken revokeRefreshToken(Client client, String refreshTokenKey) {
         refreshTokens.remove(refreshTokenKey);
-        return ModelEncryptionSupport.decryptRefreshToken(this, refreshTokenKey, key);
+        try {
+            return ModelEncryptionSupport.decryptRefreshToken(this, refreshTokenKey, key);
+        } catch (SecurityException ex) {
+            throw new OAuthServiceException(OAuthConstants.ACCESS_DENIED, ex);
+        }
     }
 
     private void encryptAccessToken(ServerAccessToken token) {


Mime
View raw message