jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1076597 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java
Date Thu, 03 Mar 2011 12:16:13 GMT
Author: angela
Date: Thu Mar  3 12:16:13 2011
New Revision: 1076597

URL: http://svn.apache.org/viewvc?rev=1076597&view=rev
Log:
JCR-2851 - Authentication Mechanism Based on Login Token

- prevent sequencial nodeids

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java?rev=1076597&r1=1076596&r2=1076597&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java
Thu Mar  3 12:16:13 2011
@@ -19,7 +19,10 @@ package org.apache.jackrabbit.core.secur
 import org.apache.jackrabbit.api.security.authentication.token.TokenCredentials;
 import org.apache.jackrabbit.api.security.principal.ItemBasedPrincipal;
 import org.apache.jackrabbit.api.security.user.User;
+import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.NodeIdFactory;
 import org.apache.jackrabbit.core.security.authentication.Authentication;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.util.ISO8601;
@@ -29,21 +32,12 @@ import org.slf4j.LoggerFactory;
 
 import javax.jcr.AccessDeniedException;
 import javax.jcr.Credentials;
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.ItemExistsException;
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.NoSuchWorkspaceException;
 import javax.jcr.Node;
 import javax.jcr.Property;
 import javax.jcr.PropertyIterator;
-import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
-import javax.jcr.lock.LockException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.version.VersionException;
 import java.security.Principal;
 import java.util.Arrays;
 import java.util.Calendar;
@@ -365,7 +359,13 @@ public class TokenBasedAuthentication im
             cal.setTimeInMillis(creationTime);
 
             String tokenName = Text.replace(ISO8601.format(cal), ":", ".");
-            Node tokenNode = tokenParent.addNode(tokenName);
+            Node tokenNode;
+            // avoid usage of sequential nodeIDs
+            if (System.getProperty(NodeIdFactory.SEQUENTIAL_NODE_ID) == null) {
+                tokenNode = tokenParent.addNode(tokenName);
+            } else {
+                tokenNode = ((NodeImpl) tokenParent).addNodeWithUuid(tokenName, NodeId.randomId().toString());
+            }
 
             String token = tokenNode.getIdentifier();
             tokenCredentials = new TokenCredentials(token);



Mime
View raw message