1 Reply Latest reply on Dec 15, 2009 12:01 AM by Tim Evers

    Programmatically re-login

    Daniel Wachter Newbie

      hi together!


      we have a big problem with seam security!
      is it possible to make a re-login programmatically?


      the programmatically login works fine, but if i try to logout and make a re-login (with another user) i have no access to the view.
      identity.isLoggedIn() returns true, but if i try to access a page which is marked as loginRequired, seam points me to the login screen...


      what do i need to perform a re-login?

      (i do perform the login and logout with Identity.instance)




      public void reLogin(String username, String password)
      {
         Identity.instance().logout;
      
         Identity.instance().getCredentials.setUsername(username);
         Identity.instance().getCredentials.setPassword(password);
         Identity.instance().login();
      }



      thank you for every hint!

      greetings daniel



        • 1. Re: Programmatically re-login
          Tim Evers Master

          I imagine doing


          Identity.instance().logout;
          



          and then in the same method trying to do


          Identity.instance().login();
          



          will cause you all sorts of problems.


          The reason for this is Identity.logout() does this:


          Session.instance().invalidate();
          



          So  you are now trying to login on an invalidated Session maybe?



          I think the more correct process here is that when a user clicks the logout button you call Identity.logout() and then redirect back to the login page. This should then cause a new Session to start that you can log in on withtout problems.


          This area is not something I know a whole lot about, but that would be where I'd start looking. :)