jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1535422 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: security/authentication/token/TokenProviderImpl.java spi/security/authentication/token/CompositeTokenProvider.java
Date Thu, 24 Oct 2013 15:56:28 GMT
Author: angela
Date: Thu Oct 24 15:56:28 2013
New Revision: 1535422

URL: http://svn.apache.org/r1535422
Log:
OAK-91 : authentication (wip)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/token/CompositeTokenProvider.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java?rev=1535422&r1=1535421&r2=1535422&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
Thu Oct 24 15:56:28 2013
@@ -227,8 +227,8 @@ public class TokenProviderImpl implement
                 } else {
                     exp = tokenExpiration;
                 }
-                long expirationTime = createExpirationTime(creationTime, exp);
-                tokenNode.setDate(TOKEN_ATTRIBUTE_EXPIRY, expirationTime);
+                long expTime = createExpirationTime(creationTime, exp);
+                tokenNode.setDate(TOKEN_ATTRIBUTE_EXPIRY, expTime);
 
                 for (String name : attributes.keySet()) {
                     if (!RESERVED_ATTRIBUTES.contains(name)) {
@@ -459,17 +459,15 @@ public class TokenProviderImpl implement
             Tree tokenTree = getTokenTree(this);
             if (tokenTree != null && tokenTree.exists()) {
                 NodeUtil tokenNode = new NodeUtil(tokenTree);
-                long expTime = getExpirationTime(tokenNode, 0);
                 if (isExpired(loginTime)) {
                     log.debug("Attempt to reset an expired token.");
                     return false;
                 }
 
-                long expiration = tokenNode.getLong(PARAM_TOKEN_EXPIRATION, tokenExpiration);
-                if (expTime - loginTime <= expiration / 2) {
-                    long expirationTime = createExpirationTime(loginTime, expiration);
+                if (expirationTime - loginTime <= tokenExpiration / 2) {
                     try {
-                        tokenNode.setDate(TOKEN_ATTRIBUTE_EXPIRY, expirationTime);
+                        long expTime = createExpirationTime(loginTime, tokenExpiration);
+                        tokenNode.setDate(TOKEN_ATTRIBUTE_EXPIRY, expTime);
                         root.commit();
                         log.debug("Successfully reset token expiration time.");
                         return true;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/token/CompositeTokenProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/token/CompositeTokenProvider.java?rev=1535422&r1=1535421&r2=1535422&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/token/CompositeTokenProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/token/CompositeTokenProvider.java
Thu Oct 24 15:56:28 2013
@@ -28,7 +28,7 @@ import com.google.common.collect.Immutab
  * Aggregates a collection of {@link TokenProvider}s into a single
  * provider.
  */
-public class CompositeTokenProvider implements TokenProvider {
+public final class CompositeTokenProvider implements TokenProvider {
 
     private final List<TokenProvider> providers;
 



Mime
View raw message