Return-Path: Delivered-To: apmail-incubator-sling-commits-archive@locus.apache.org Received: (qmail 52483 invoked from network); 11 Nov 2008 15:22:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Nov 2008 15:22:28 -0000 Received: (qmail 28909 invoked by uid 500); 11 Nov 2008 15:22:35 -0000 Delivered-To: apmail-incubator-sling-commits-archive@incubator.apache.org Received: (qmail 28895 invoked by uid 500); 11 Nov 2008 15:22:35 -0000 Mailing-List: contact sling-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sling-dev@incubator.apache.org Delivered-To: mailing list sling-commits@incubator.apache.org Received: (qmail 28886 invoked by uid 99); 11 Nov 2008 15:22:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Nov 2008 07:22:35 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Nov 2008 15:21:16 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 61083238889C; Tue, 11 Nov 2008 07:21:59 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: sling-commits@incubator.apache.org From: fmeschbe@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081111152159.61083238889C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 javax.jcr.Credentials extracted from the request */ private final Credentials credentials; + /** + * The name of the workspace this user is wishing to login, + * null 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 null workspace name. + * * @param authType The authentication type, must not be null. * @param credentials The credentials, must not be null. * @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 null. + * @param credentials The credentials, must not be null. + * @param workspaceName The name of the workspace to connect to, may be + * null 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 null, 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);