cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/2] cxf git commit: Some trivial fixes
Date Fri, 04 Dec 2015 12:46:13 GMT
Some trivial fixes


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

Branch: refs/heads/3.0.x-fixes
Commit: 8e39d46404adf69d694fa8faceb045436146c706
Parents: d2a2a24
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Fri Dec 4 12:38:49 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Fri Dec 4 12:46:00 2015 +0000

----------------------------------------------------------------------
 .../cxf/rs/security/oauth2/filters/OAuthRequestFilter.java       | 2 +-
 .../security/oauth2/services/AuthorizationCodeGrantService.java  | 4 ++--
 .../java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/8e39d464/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java
index c11cbc2..1a397c5 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java
@@ -108,7 +108,7 @@ public class OAuthRequestFilter extends AbstractAccessTokenValidator
             }
         }
         
-        if (permissions.size() > 0 && matchingPermissions.isEmpty() 
+        if (!permissions.isEmpty() && matchingPermissions.isEmpty() 
             || allPermissionsMatch && (matchingPermissions.size() != permissions.size())
             || !requiredScopes.isEmpty() && requiredScopes.size() != matchingPermissions.size())
{
             String message = "Client has no valid permissions";

http://git-wip-us.apache.org/repos/asf/cxf/blob/8e39d464/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
index ab56e06..8e7c966 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AuthorizationCodeGrantService.java
@@ -52,7 +52,7 @@ import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
  */
 @Path("/authorize")
 public class AuthorizationCodeGrantService extends RedirectionBasedGrantService {
-    private static final Integer RECOMMENDED_CODE_EXPIRY_TIME_MINS = 10;
+    private static final long RECOMMENDED_CODE_EXPIRY_TIME_SECS = 10L * 60L;
     private boolean canSupportPublicClients;
     private boolean canSupportEmptyRedirectForPrivateClients;
     private OOBResponseDeliverer oobDeliverer;
@@ -113,7 +113,7 @@ public class AuthorizationCodeGrantService extends RedirectionBasedGrantService
         } catch (OAuthServiceException ex) {
             return createErrorResponse(params, redirectUri, OAuthConstants.ACCESS_DENIED);
         }
-        if (grant.getExpiresIn() / 60 > RECOMMENDED_CODE_EXPIRY_TIME_MINS) {
+        if (grant.getExpiresIn() > RECOMMENDED_CODE_EXPIRY_TIME_SECS) {
             LOG.warning("Code expiry time exceeds 10 minutes");
         }
         String grantCode = processCodeGrant(client, grant.getCode(), grant.getSubject());

http://git-wip-us.apache.org/repos/asf/cxf/blob/8e39d464/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
index d4c5dcd..59d1da7 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
@@ -165,12 +165,12 @@ public final class OAuthUtils {
     }
     
     public static long getIssuedAt() {
-        return System.currentTimeMillis() / 1000;
+        return System.currentTimeMillis() / 1000L;
     }
     
     public static boolean isExpired(Long issuedAt, Long lifetime) {
         return lifetime != 0L
-            && issuedAt + lifetime < System.currentTimeMillis() / 1000;
+            && issuedAt + lifetime < System.currentTimeMillis() / 1000L;
     }
     
     public static boolean validateAudience(String audience, List<String> audiences)
{


Mime
View raw message