Hi,

I would like to do stuff with current subject on SessionListener.onStart()or
AuthenticationListener.onSuccess() using SecurityUtils.getSubject() but the
subject is not yet authenticated... Is that normal?

Here is how I authenticate my subject:

Subject subject = SecurityUtils.getSubject();
subject.login(new UsernamePasswordToken(username, password));

Then in the SessionListener, the subject principal is null:

@Override
public void onStart(Session session) {
  Subject subject = SecurityUtils.getSubject();
  Object principal = subject.getPrincipal(); // this is null
}

Same thing in the AuthenticationListener:

@Override
public void onSuccess(AuthenticationToken token, AuthenticationInfo info) {
  Subject subject = SecurityUtils.getSubject();
  Object principal = subject.getPrincipal(); // this is null
}

Any idea of what's wrong ?

Cedric

Reply via email to