• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Create&initialize a session programmatically?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Create&initialize a session programmatically?


  • Subject: Create&initialize a session programmatically?
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 4 Apr 2005 00:39:28 +0200

Oh, by the way, the logout code reminds me of a problem I haven't found a solution yet: does anybody know how to create & initialize session programmatically?

Let's say an admin is logged in, and he wants to log in into another window as a selected user. The basic code, of course, may look almost eactly like the previous one (just without terminating the current session):

public WOComponent logInAsAnotherUser() { // to be used for WOHyperlink with target=_blank
WORedirect wor=new WORedirect(context());
wor.setUrl(context().directActionURLForActionNamed("default",null));
return wor;
}


Now, presume I would like to log in the new user automatically, something like

public WOComponent logInAsAnotherUser(User newUser) { // to be used for WOHyperlink with target=_blank
???
}


I could do that somewhat ugly way through Direct Actions of course, storing the user's login and password into the WORedirect URL and setting up a log in direct action, but that's not only ugly, but insecure also. What I actually need is something like

// naive code, which does not work for many reasons
public WOComponent logInAsAnotherUser(User newUser) { // to be used for WOHyperlink with target=_blank
WOSession newSession=new Session();
newSession.setUser(newUser);
return newSession.pageWithName("Main"); // well, does not exist, but you know what I mean, don't you?
}


Does anybody know how to write such a method?
---
Ondra Čada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >WOA, Building a Login form (From: Amedeo Mantica <email@hidden>)
 >Re: WOA, Building a Login form (From: Drew Thoeni <email@hidden>)
 >Re: WOA, Building a Login form (From: Amedeo Mantica <email@hidden>)
 >Re: WOA, Building a Login form (From: Drew Thoeni <email@hidden>)
 >Re: WOA, Building a Login form (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: WOA, Building a Login form
  • Next by Date: Re: WOA, Building a Login form
  • Previous by thread: Re: WOA, Building a Login form
  • Next by thread: Re: WOA, Building a Login form
  • Index(es):
    • Date
    • Thread