You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Marc Speck <ma...@gmail.com> on 2008/11/07 15:39:44 UTC

multitenancy

We are evaluating Sling for a multitenancy app. Nothing is shared between
tenants and we need to be able to move tenants across servers. So we plan to
create a workspace for each tenant. In order not to interfere with Sling
paths, the workspace is coded into the host name, e.g.
hugosworkspace.example.org. We thought about adding the workspaceName to
AuthenticationInfo(String authType, Credentials credentials, String
workspaceName). And then add it in SlingAuthenticator:

Index: SlingAuthenticator.java
===================================================================
--- SlingAuthenticator.java    (revision 712084)
+++ SlingAuthenticator.java    (working copy)
@@ -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);


This does not change the current behaviour but gives us an API for changing
the workspace with a custom AuthenticationHandler. sudoParameterName and
Sling-handled anonymous sessions are not possible for tenants but that does
not matter for our use case.

What do you think?
Marc

Re: multitenancy

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Nov 11, 2008 at 12:24 PM, Marc Speck <ma...@gmail.com> wrote:

> ...it seems the new proposal of Felix about ResourceResolverFactory,
> http://cwiki.apache.org/SLING/add-resourceresolverfactory-service-interface.html,
> also allows my use case....

Ah good - didn't find time to read that yet ;-)

-Bertrand

Re: multitenancy

Posted by Marc Speck <ma...@gmail.com>.
Hi Felix
>
>
> Marc Speck schrieb:
> > Thanks for the feedback, Bertrand. I'm happy to provide this minor patch.
> > However, it seems the new proposal of Felix about
> ResourceResolverFactory,
> >
> http://cwiki.apache.org/SLING/add-resourceresolverfactory-service-interface.html
> ,
> > also allows my use case. So should you find agreement on the proposal
> > and
> > implement it in the next weeks, I'm fine with waiting for it.
>
> In fact, your initial message prompted me to finally publicize the
> proposal ;-) So, I didn't want to answer to your request too early.


yeah, I thought so.


>
> Since, the proposal is most probably not going to be implemented within
> a day or two ;-), your proposal makes absolute sense to me. (In fact I
> have implemented some prototype in my workspace to look at it ;-) ).


great!


>
>
> My propotype just extends the AuthenticationInfo class by adding another
> constructor taking the workspace name and a new getWorkspaceName method.

Yep, I did the same.


>
> Would you mind to create a JIRA for this ? Then I will ASAP commit this
> extension.


https://issues.apache.org/jira/browse/SLING-727


>
>
> Thinking of compatibility: It think we can easily turn the
> AuthenticationInfo class into a Map<String, Object> suitable for the
> proposed ResourceProviderFactory.getResourceProvider method for it to be
> used by AuthenticationHandler implementations. So this proposal can
> still be supported even with ResourceResolverFactory implemented.


That's fine with me.

Marc

Re: multitenancy

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Mark,

Marc Speck schrieb:
> Thanks for the feedback, Bertrand. I'm happy to provide this minor patch.
> However, it seems the new proposal of Felix about ResourceResolverFactory,
> http://cwiki.apache.org/SLING/add-resourceresolverfactory-service-interface.html,
> also allows my use case. So should you find agreement on the proposal
> and
> implement it in the next weeks, I'm fine with waiting for it.

In fact, your initial message prompted me to finally publicize the
proposal ;-) So, I didn't want to answer to your request too early.

Since, the proposal is most probably not going to be implemented within
a day or two ;-), your proposal makes absolute sense to me. (In fact I
have implemented some prototype in my workspace to look at it ;-) ).

My propotype just extends the AuthenticationInfo class by adding another
constructor taking the workspace name and a new getWorkspaceName method.

Would you mind to create a JIRA for this ? Then I will ASAP commit this
extension.

Thinking of compatibility: It think we can easily turn the
AuthenticationInfo class into a Map<String, Object> suitable for the
proposed ResourceProviderFactory.getResourceProvider method for it to be
used by AuthenticationHandler implementations. So this proposal can
still be supported even with ResourceResolverFactory implemented.

Regards
Felix

> 
> Marc
> 
> 
> 
> 
> On Tue, Nov 11, 2008 at 12:10 PM, Bertrand Delacretaz <
> bdelacretaz@apache.org> wrote:
> 
>> Hi Marc,
>>
>> On Fri, Nov 7, 2008 at 3:39 PM, Marc Speck <ma...@gmail.com> wrote:
>>
>>> ....We thought about adding the workspaceName to
>>> AuthenticationInfo(String authType, Credentials credentials, String
>>> workspaceName)....
>> Ok, as long as you keep the existing constructor.
>>
>>> ... And then add it in SlingAuthenticator:
>>>
>>> ...                Session session = getRepository().login(
>>> -                    authInfo.getCredentials(), null);
>>> +                    authInfo.getCredentials(),
>>> authInfo.getWorkspaceName());...
>> Sounds good to me!
>>
>> -Bertrand
>>
> 

Re: multitenancy

Posted by Marc Speck <ma...@gmail.com>.
Thanks for the feedback, Bertrand. I'm happy to provide this minor patch.
However, it seems the new proposal of Felix about ResourceResolverFactory,
http://cwiki.apache.org/SLING/add-resourceresolverfactory-service-interface.html,
also allows my use case. So should you find agreement on the proposal
and
implement it in the next weeks, I'm fine with waiting for it.

Marc




On Tue, Nov 11, 2008 at 12:10 PM, Bertrand Delacretaz <
bdelacretaz@apache.org> wrote:

> Hi Marc,
>
> On Fri, Nov 7, 2008 at 3:39 PM, Marc Speck <ma...@gmail.com> wrote:
>
> > ....We thought about adding the workspaceName to
> > AuthenticationInfo(String authType, Credentials credentials, String
> > workspaceName)....
>
> Ok, as long as you keep the existing constructor.
>
> > ... And then add it in SlingAuthenticator:
> >
> > ...                Session session = getRepository().login(
> > -                    authInfo.getCredentials(), null);
> > +                    authInfo.getCredentials(),
> > authInfo.getWorkspaceName());...
>
> Sounds good to me!
>
> -Bertrand
>

Re: multitenancy

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Marc,

On Fri, Nov 7, 2008 at 3:39 PM, Marc Speck <ma...@gmail.com> wrote:

> ....We thought about adding the workspaceName to
> AuthenticationInfo(String authType, Credentials credentials, String
> workspaceName)....

Ok, as long as you keep the existing constructor.

> ... And then add it in SlingAuthenticator:
>
> ...                Session session = getRepository().login(
> -                    authInfo.getCredentials(), null);
> +                    authInfo.getCredentials(),
> authInfo.getWorkspaceName());...

Sounds good to me!

-Bertrand