cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Minor update to AbstractOAuthProvider to revoke expired refresh tokens if needed
Date Mon, 28 Dec 2015 16:31:59 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes dcc7914dc -> 23be2c7dd


Minor update to AbstractOAuthProvider to revoke expired refresh tokens if needed


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

Branch: refs/heads/3.1.x-fixes
Commit: 23be2c7dd3912b719746e0b68f33208b3608fac1
Parents: dcc7914
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Dec 28 16:30:54 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Dec 28 16:31:44 2015 +0000

----------------------------------------------------------------------
 .../security/oauth2/provider/AbstractOAuthDataProvider.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/23be2c7d/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 367997f..edfabb6 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
@@ -81,8 +81,13 @@ public abstract class AbstractOAuthDataProvider implements OAuthDataProvider,
Cl
                                                 List<String> restrictedScopes) throws
OAuthServiceException {
         RefreshToken currentRefreshToken = recycleRefreshTokens 
             ? revokeRefreshToken(refreshTokenKey) : getRefreshToken(refreshTokenKey);
-        if (currentRefreshToken == null 
-            || OAuthUtils.isExpired(currentRefreshToken.getIssuedAt(), currentRefreshToken.getExpiresIn()))
{
+        if (currentRefreshToken == null) { 
+            throw new OAuthServiceException(OAuthConstants.ACCESS_DENIED);
+        }
+        if (OAuthUtils.isExpired(currentRefreshToken.getIssuedAt(), currentRefreshToken.getExpiresIn()))
{
+            if (!recycleRefreshTokens) {
+                revokeRefreshToken(refreshTokenKey);
+            }
             throw new OAuthServiceException(OAuthConstants.ACCESS_DENIED);
         }
         if (recycleRefreshTokens) {


Mime
View raw message