jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Angela Schreiber <anch...@adobe.com>
Subject Re: Login parameters
Date Mon, 29 Jul 2013 09:40:59 GMT
hi jukka

my preference would be variant 3):
- it feels quite natural to me to pass extra information to the repo-login.
- jackrabbit api is widely used as JackrabbitSession is needed to
  obtain the extended security functionality provided by jackrabbit api
- having the param-map makes it is easily extendible for custom
authentication 
  setup scenarios
- we might even provide different flavors of the method also covering
  the null-credentials and null-workspace login.

1. looks straight forward but is rather cumbersome since we not only
have SimpleCredentials but also javax.jcr.GuestCredentials and
the TokenCredentials defined by the JCR API. reducing the read-only
functionality to SimpleCredentials obviously doesn't serve the purpose
as the most common read-only session is probably the guest-login.

2. doesn't work for login without passing a workspace name which is
IMO much more common that passing the workspace name. in particular
in our CQ setup where we have one single workspace anyway.

4. looks over complex to me for something that feels like being a
totally natural parameter to the login call.

kind regards
angela

On 7/29/13 11:20 AM, "Jukka Zitting" <jukka.zitting@gmail.com> wrote:

>Hi,
>
>It would be useful to be able to pass in extra parameters in a
>Repository.login() call, in order to for example control the
>auto-refresh or read-only status of the created session. Unfortunately
>the standard JCR API doesn't provide any straightforward way to do
>this, so I've come up with a few potential solutions:
>
>1. Use the attribute feature of SimpleCredentials to pass such parameters:
>
>    SimpleCredentials credentials = ...;
>    credentials.setAttribute("AutoRefresh", true);
>    Session session = repository.login(credentials, ...);
>
>The downside is that it's tied to the specific Credentials class being
>used.
>
>2. Use the URI query parameter syntax to pass such parameters as a
>part of the workspace name:
>
>    String workspace = ...;
>    Session session = repository.login(..., workspace +
>"?AutoRefresh=true");
>
>The downside is the extra complexity of parsing the workspace string
>and the need to in many case look up the default workspace name
>(unless we define "?..." to refer to the default workspace).
>
>3. Extend the JackrabbitRepository interface with a new login() method
>that explicitly allows such extra parameters:
>
>    Map<String, Object> parameters =
>        Collections.singletonMap("AutoRefresh", true);
>    Session session = repository.login(..., parameters);
>
>The downside is the need for the custom API extension and the
>adjustments to all relevant implementations. We probably could justify
>adding such a method in JCR 2.1.
>
>4. Add a new utility class that uses a thread-local variable to pass
>such extra parameters through a normal login() call:
>
>    Map<String, Object> parameters =
>        Collections.singletonMap("AutoRefresh", true);
>    Session session = LoginWrapper.login(repository, ..., parameters);
>
>The downside is the need for the custom utility class, and the extra
>complexity (especially for remoting) of using thread-local variables.
>
>WDYT?
>
>BR,
>
>Jukka Zitting


Mime
View raw message