Hi Christophe,
I can see that it would be quite easy to expose this information, via DomainObjectContainerDefault#getUser(), which just copies information out of AuthenticationManagerStandard. The difficulty though is that it would create a coupling to a specific implementation of AuthenticationManager, whereas we want this to be pluggable.

What you could legitimately do though is to write your own subclass of DomainObjectContainerDefault, along with your own subclasses of UserMemento, eg:

public class MyDomainObjectContainer extends DomainObjectContainerDefault {

    @Override
    public UserMemento getUser() {

final AuthenticationSessionAbstract session = (AuthenticationSessionAbstract)getAuthenticationSessionProvider().getAuthenticationSession();

        final String name = session.getUserName();
final List<RoleMemento> roleMementos = asRoleMementos(session.getRoles());

final MyUserMemento user = new MyUserMemento(name, roleMementos, session.getCode());
        return user;
    }

}

you would then register in isis.properties using:

isis.persistor.domain-object-container=com.mycompany.myapp.MyDomainObjectContainer

Let us know if that works for you,

Cheers
Dan



On 23/02/2011 05:42, [email protected] wrote:
Hi,

I'm working on an app where users don't need to log in straightaway, so I
need the session information. Having a look at the isis code,
AuthenticationManagerStandard creates a unique validation code for
sessions which I'm using to distinguish the sessions. Is this the right
way to do it? If so could we make this available to AbstractDomainObject ?

Thanks,
Christophe

Reply via email to