Hi,

in our application the user's rights depend on the location (Munich,
Berlin,...).
There's a drop down choice, where the user can change the location, on which
he wants to work.

So, when he changes the location, also the principals (permissions) have to
be changed.

How can I remove the old principals and add new ones within the same session
?

Is it possible to remove the LoginContext from the session and add a new one
?

Thanks
Andrea



ApplLoginContext:
-----------------------

public class ApplLoginContext extends LoginContext
{
 ...
 public final Subject login() throws LoginException
 {
     ...
  DefaultSubject subject = new DefaultSubject ();
  ...
  // grant principals
  subject.addPrincipal(new SimplePrincipal("TEST_ADMIN"));

  return subject;
 }
}

Login.java:
--------------

public class Login extends AppBasePage
{
 ...
 public class LoginForm extends Form
 {
 ...
  public void onSubmit()
  {
   ...
   // add principals of logged in user to the context
   ApplLoginContext context = new ApplLoginContext(loggedInPerson);
   try
   {
     ((WaspSession)getSession()).login(context);
   }
   catch (LoginException e)
   {
    ...
   }
  }
 }
}

Reply via email to