incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r713058 - in /incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine: auth/AuthenticationInfo.java impl/auth/SlingAuthenticator.java
Date Tue, 11 Nov 2008 15:21:58 GMT
Author: fmeschbe
Date: Tue Nov 11 07:21:57 2008
New Revision: 713058

URL: http://svn.apache.org/viewvc?rev=713058&view=rev
Log:
SLING-727 Add support for bearing the workspace name in the AuthenticationInfo
for use by the SlingAuthenticator to acquire the session

Modified:
    incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/auth/AuthenticationInfo.java
    incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java

Modified: incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/auth/AuthenticationInfo.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/auth/AuthenticationInfo.java?rev=713058&r1=713057&r2=713058&view=diff
==============================================================================
--- incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/auth/AuthenticationInfo.java
(original)
+++ incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/auth/AuthenticationInfo.java
Tue Nov 11 07:21:57 2008
@@ -40,24 +40,48 @@
     /** The <code>javax.jcr.Credentials</code> extracted from the request */
     private final Credentials credentials;
 
+    /**
+     * The name of the workspace this user is wishing to login,
+     * <code>null</code> means the default workspace.
+     */
+    private final String workspaceName;
+
     /** Creates an empty instance, used for the {@link #DOING_AUTH} constants */
     private AuthenticationInfo() {
-        authType = null;
-        credentials = null;
+        this(null, null, null);
     }
 
     /**
      * Creates an instance of this class with the given authentication type and
-     * credentials.
-     *
+     * credentials connecting to the default workspace as if the
+     * {@link #AuthenticationInfo(String, Credentials, String)} method would be
+     * called with a <code>null</code> workspace name.
+     * 
      * @param authType The authentication type, must not be <code>null</code>.
      * @param credentials The credentials, must not be <code>null</code>.
      * @see #getAuthType()
      * @see #getCredentials()
      */
     public AuthenticationInfo(String authType, Credentials credentials) {
+        this(authType, credentials, null);
+    }
+
+    /**
+     * Creates an instance of this class with the given authentication type and
+     * credentials.
+     * 
+     * @param authType The authentication type, must not be <code>null</code>.
+     * @param credentials The credentials, must not be <code>null</code>.
+     * @param workspaceName The name of the workspace to connect to, may be
+     *            <code>null</code> to connect to the default workspace.
+     * @see #getAuthType()
+     * @see #getCredentials()
+     */
+    public AuthenticationInfo(String authType, Credentials credentials,
+            String workspaceName) {
         this.authType = authType;
         this.credentials = credentials;
+        this.workspaceName = workspaceName;
     }
 
     /**
@@ -80,4 +104,12 @@
         return credentials;
     }
 
+    /**
+     * Returns the name of the workspace the user contained in this instance
+     * wishes to connect to. This may be <code>null</code>, in which case the
+     * user is connected to the default workspace.
+     */
+    public String getWorkspaceName() {
+        return workspaceName;
+    }
 }

Modified: incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java?rev=713058&r1=713057&r2=713058&view=diff
==============================================================================
--- incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java
(original)
+++ incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java
Tue Nov 11 07:21:57 2008
@@ -217,7 +217,7 @@
             try {
                 log.debug("authenticate: credentials, trying to get a session");
                 Session session = getRepository().login(
-                    authInfo.getCredentials(), null);
+                    authInfo.getCredentials(), authInfo.getWorkspaceName());
 
                 // handle impersonation
                 session = handleImpersonation(req, res, session);



Mime
View raw message