method of implementing a 'login' section in a site
hi, Thanks a lot for the email guys!! Another question I want to ask. I want to create a section of my site where I only allow users to use IF they have logged into my site. Either than using cookies to keep track if they have logged in or not, what method should I use to keep track of their status on each page? Anson - Original Message - From: "Marco Tedone" <[EMAIL PROTECTED]> Date: Tuesday, September 9, 2003 10:36 am Subject: Re: EJB in tomcat > Well, Tomcat needs to 'colloquiate' with an application server > (where EJBs > are deployed). The answer is yes, it's possible; all your > application needs > to do is to establish a context with an application server and > then it can > use the component deployed on application server generally using a > lookup. > Here follow a snippet from a code: > > InitialContext context = null; > //getJbossContext() sets up the correct property file and returns > a context > initialized to that property file > context = getJbossContext(); > Object node = context.lookup(sessionName); > PeopleDbManagerHome home = > (PeopleDbManagerHome)PortableRemoteObject.narrow(node, > PeopleDbManagerHome.class); > bean = home.create(); > } catch (RemoteException e) { > printRemoteExceptionMessage(); > return null; > } > Hope it will help, > > Marco > > - Original Message - > From: "zeallousbigpond.net.au" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, September 09, 2003 1:17 AM > Subject: EJB in tomcat > > > > hi, > > > > I would like to ask, can Tomcat work with Enterprise > > Javabeans? 'cause I read from the Java site...it says that we > need a > > BEA server? Is it necessary? Or tomcat it self already has those > > libraries. > > > > Anson > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: method of implementing a 'login' section in a site
use the servlet specification way!! ie, protect your pages with entries in web.xml then tomcat will log in the users for you Filip - Original Message - From: "zeallousbigpond.net.au" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Monday, September 08, 2003 7:00 PM Subject: method of implementing a 'login' section in a site hi, Thanks a lot for the email guys!! Another question I want to ask. I want to create a section of my site where I only allow users to use IF they have logged into my site. Either than using cookies to keep track if they have logged in or not, what method should I use to keep track of their status on each page? Anson - Original Message - From: "Marco Tedone" <[EMAIL PROTECTED]> Date: Tuesday, September 9, 2003 10:36 am Subject: Re: EJB in tomcat > Well, Tomcat needs to 'colloquiate' with an application server > (where EJBs > are deployed). The answer is yes, it's possible; all your > application needs > to do is to establish a context with an application server and > then it can > use the component deployed on application server generally using a > lookup. > Here follow a snippet from a code: > > InitialContext context = null; > //getJbossContext() sets up the correct property file and returns > a context > initialized to that property file > context = getJbossContext(); > Object node = context.lookup(sessionName); > PeopleDbManagerHome home = > (PeopleDbManagerHome)PortableRemoteObject.narrow(node, > PeopleDbManagerHome.class); > bean = home.create(); > } catch (RemoteException e) { > printRemoteExceptionMessage(); > return null; > } > Hope it will help, > > Marco > > - Original Message - > From: "zeallousbigpond.net.au" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, September 09, 2003 1:17 AM > Subject: EJB in tomcat > > > > hi, > > > > I would like to ask, can Tomcat work with Enterprise > > Javabeans? 'cause I read from the Java site...it says that we > need a > > BEA server? Is it necessary? Or tomcat it self already has those > > libraries. > > > > Anson > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: method of implementing a 'login' section in a site
haha thanks...but..how do you do that? =P Anson - Original Message - From: "Filip Hanik" <[EMAIL PROTECTED]> Date: Tuesday, September 9, 2003 12:04 pm Subject: Re: method of implementing a 'login' section in a site > use the servlet specification way!! > > ie, protect your pages with entries in web.xml > then tomcat will log in the users for you > > Filip > - Original Message - > From: "zeallousbigpond.net.au" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <[EMAIL PROTECTED]> > Sent: Monday, September 08, 2003 7:00 PM > Subject: method of implementing a 'login' section in a site > > > hi, > >Thanks a lot for the email guys!! Another question I want to > ask. I > want to create a section of my site where I only allow users to > use IF > they have logged into my site. Either than using cookies to keep > track > if they have logged in or not, what method should I use to keep > track > of their status on each page? > > Anson > > - Original Message - > From: "Marco Tedone" <[EMAIL PROTECTED]> > Date: Tuesday, September 9, 2003 10:36 am > Subject: Re: EJB in tomcat > > > Well, Tomcat needs to 'colloquiate' with an application server > > (where EJBs > > are deployed). The answer is yes, it's possible; all your > > application needs > > to do is to establish a context with an application server and > > then it can > > use the component deployed on application server generally using > a > > lookup. > > Here follow a snippet from a code: > > > > InitialContext context = null; > > //getJbossContext() sets up the correct property file and > returns > > a context > > initialized to that property file > > context = getJbossContext(); > > Object node = context.lookup(sessionName); > > PeopleDbManagerHome home = > > (PeopleDbManagerHome)PortableRemoteObject.narrow(node, > > PeopleDbManagerHome.class); > > bean = home.create(); > > } catch (RemoteException e) { > > printRemoteExceptionMessage(); > > return null; > > } > > Hope it will help, > > > > Marco > > > > - Original Message - > > From: "zeallousbigpond.net.au" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, September 09, 2003 1:17 AM > > Subject: EJB in tomcat > > > > > > > hi, > > > > > > I would like to ask, can Tomcat work with Enterprise > > > Javabeans? 'cause I read from the Java site...it says that we > > need a > > > BEA server? Is it necessary? Or tomcat it self already has those > > > libraries. > > > > > > Anson > > > > > > > > > > > > --- > -- > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: tomcat-user- > [EMAIL PROTECTED]> > > > > > > > > > > > - > -- > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > --- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: method of implementing a 'login' section in a site
The way i prefer to do it is use a simple db with the user atributes (userid , password , etc), use cookies to check if the user is logged in or not. one thing i had problems with when i first implemented this solution is that the cookies are stored in a browser specific place and you might not be able to access them easilly. a work round to this is to set the cookie path yourself from a methid in the API (i dont have it at the top of my head i will look it up) and get the cookie reference using the location where the cookie is stored Billy --- "zeallousbigpond.net.au" <[EMAIL PROTECTED]> wrote: > hi, > > Thanks a lot for the email guys!! Another > question I want to ask. I > want to create a section of my site where I only > allow users to use IF > they have logged into my site. Either than using > cookies to keep track > if they have logged in or not, what method should I > use to keep track > of their status on each page? > > Anson > > - Original Message - > From: "Marco Tedone" <[EMAIL PROTECTED]> > Date: Tuesday, September 9, 2003 10:36 am > Subject: Re: EJB in tomcat > > > Well, Tomcat needs to 'colloquiate' with an > application server > > (where EJBs > > are deployed). The answer is yes, it's possible; > all your > > application needs > > to do is to establish a context with an > application server and > > then it can > > use the component deployed on application server > generally using a > > lookup. > > Here follow a snippet from a code: > > > > InitialContext context = null; > > //getJbossContext() sets up the correct property > file and returns > > a context > > initialized to that property file > > context = getJbossContext(); > > Object node = context.lookup(sessionName); > > PeopleDbManagerHome home = > > > (PeopleDbManagerHome)PortableRemoteObject.narrow(node, > > PeopleDbManagerHome.class); > > bean = home.create(); > > } catch (RemoteException e) { > > printRemoteExceptionMessage(); > > return null; > > } > > Hope it will help, > > > > Marco > > > > - Original Message - > > From: "zeallousbigpond.net.au" > <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, September 09, 2003 1:17 AM > > Subject: EJB in tomcat > > > > > > > hi, > > > > > > I would like to ask, can Tomcat work with > Enterprise > > > Javabeans? 'cause I read from the Java site...it > says that we > > need a > > > BEA server? Is it necessary? Or tomcat it self > already has those > > > libraries. > > > > > > Anson > > > > > > > > > > > > > - > > > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > > > > > --- > > -- > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: method of implementing a 'login' section in a site
http://java.sun.com/webservices/docs/1.1/tutorial/doc/ Specifically: http://java.sun.com/webservices/docs/1.1/tutorial/doc/WebAppSecurity4.html#wp80556 -Tim zeallousbigpond.net.au wrote: haha thanks...but..how do you do that? =P Anson - Original Message - From: "Filip Hanik" <[EMAIL PROTECTED]> Date: Tuesday, September 9, 2003 12:04 pm Subject: Re: method of implementing a 'login' section in a site use the servlet specification way!! ie, protect your pages with entries in web.xml then tomcat will log in the users for you Filip - Original Message - From: "zeallousbigpond.net.au" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Monday, September 08, 2003 7:00 PM Subject: method of implementing a 'login' section in a site hi, Thanks a lot for the email guys!! Another question I want to ask. I want to create a section of my site where I only allow users to use IF they have logged into my site. Either than using cookies to keep track if they have logged in or not, what method should I use to keep track of their status on each page? Anson - Original Message - From: "Marco Tedone" <[EMAIL PROTECTED]> Date: Tuesday, September 9, 2003 10:36 am Subject: Re: EJB in tomcat Well, Tomcat needs to 'colloquiate' with an application server (where EJBs are deployed). The answer is yes, it's possible; all your application needs to do is to establish a context with an application server and then it can use the component deployed on application server generally using a lookup. Here follow a snippet from a code: InitialContext context = null; //getJbossContext() sets up the correct property file and returns a context initialized to that property file context = getJbossContext(); Object node = context.lookup(sessionName); PeopleDbManagerHome home = (PeopleDbManagerHome)PortableRemoteObject.narrow(node, PeopleDbManagerHome.class); bean = home.create(); } catch (RemoteException e) { printRemoteExceptionMessage(); return null; } Hope it will help, Marco - Original Message - From: "zeallousbigpond.net.au" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 09, 2003 1:17 AM Subject: EJB in tomcat hi, I would like to ask, can Tomcat work with Enterprise Javabeans? 'cause I read from the Java site...it says that we need a BEA server? Is it necessary? Or tomcat it self already has those libraries. Anson --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: tomcat-user- [EMAIL PROTECTED]> > - -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: method of implementing a 'login' section in a site
I don't get ityou mean you have to can set the cookie yourself?? -Original Message- From: Billy Kantartzis [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 09, 2003 8:41 PM To: Tomcat Users List Subject: Re: method of implementing a 'login' section in a site The way i prefer to do it is use a simple db with the user atributes (userid , password , etc), use cookies to check if the user is logged in or not. one thing i had problems with when i first implemented this solution is that the cookies are stored in a browser specific place and you might not be able to access them easilly. a work round to this is to set the cookie path yourself from a methid in the API (i dont have it at the top of my head i will look it up) and get the cookie reference using the location where the cookie is stored Billy --- "zeallousbigpond.net.au" <[EMAIL PROTECTED]> wrote: > hi, > > Thanks a lot for the email guys!! Another > question I want to ask. I > want to create a section of my site where I only > allow users to use IF > they have logged into my site. Either than using > cookies to keep track > if they have logged in or not, what method should I > use to keep track > of their status on each page? > > Anson > > - Original Message - > From: "Marco Tedone" <[EMAIL PROTECTED]> > Date: Tuesday, September 9, 2003 10:36 am > Subject: Re: EJB in tomcat > > > Well, Tomcat needs to 'colloquiate' with an > application server > > (where EJBs > > are deployed). The answer is yes, it's possible; > all your > > application needs > > to do is to establish a context with an > application server and > > then it can > > use the component deployed on application server > generally using a > > lookup. > > Here follow a snippet from a code: > > > > InitialContext context = null; > > //getJbossContext() sets up the correct property > file and returns > > a context > > initialized to that property file > > context = getJbossContext(); > > Object node = context.lookup(sessionName); PeopleDbManagerHome home > > = > > > (PeopleDbManagerHome)PortableRemoteObject.narrow(node, > > PeopleDbManagerHome.class); > > bean = home.create(); > > } catch (RemoteException e) { printRemoteExceptionMessage(); > > return null; > > } > > Hope it will help, > > > > Marco > > > > - Original Message - > > From: "zeallousbigpond.net.au" > <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, September 09, 2003 1:17 AM > > Subject: EJB in tomcat > > > > > > > hi, > > > > > > I would like to ask, can Tomcat work with > Enterprise > > > Javabeans? 'cause I read from the Java site...it > says that we > > need a > > > BEA server? Is it necessary? Or tomcat it self > already has those > > > libraries. > > > > > > Anson > > > > > > > > > > > > > - > > > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > > > > > --- > > -- > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: method of implementing a 'login' section in a site
Well, what I can tell you what I've done, and then you're free to choose (what a nice thing freedom...). I authenticated the user against a database; if the user is authenticated, then I set a session attribute like (type String): isUserAuthenticated. Then, I wrote two custom tags (isUserAuthenticated, isNotUserAuthenticated) which respectively executed the code within a depending whether the session attribute isUser exists (i.e. != null) or not. Then, in my JSP page, I wrote something like the following: forward her to the login page I discovered this method is also useful to allow 'Administration' functionality, so that similarly you may declared Hope this will help, Marco - Original Message - From: "zeallousbigpond.net.au" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Tuesday, September 09, 2003 3:00 AM Subject: method of implementing a 'login' section in a site > hi, > > Thanks a lot for the email guys!! Another question I want to ask. I > want to create a section of my site where I only allow users to use IF > they have logged into my site. Either than using cookies to keep track > if they have logged in or not, what method should I use to keep track > of their status on each page? > > Anson > > - Original Message - > From: "Marco Tedone" <[EMAIL PROTECTED]> > Date: Tuesday, September 9, 2003 10:36 am > Subject: Re: EJB in tomcat > > > Well, Tomcat needs to 'colloquiate' with an application server > > (where EJBs > > are deployed). The answer is yes, it's possible; all your > > application needs > > to do is to establish a context with an application server and > > then it can > > use the component deployed on application server generally using a > > lookup. > > Here follow a snippet from a code: > > > > InitialContext context = null; > > //getJbossContext() sets up the correct property file and returns > > a context > > initialized to that property file > > context = getJbossContext(); > > Object node = context.lookup(sessionName); > > PeopleDbManagerHome home = > > (PeopleDbManagerHome)PortableRemoteObject.narrow(node, > > PeopleDbManagerHome.class); > > bean = home.create(); > > } catch (RemoteException e) { > > printRemoteExceptionMessage(); > > return null; > > } > > Hope it will help, > > > > Marco > > > > - Original Message - > > From: "zeallousbigpond.net.au" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, September 09, 2003 1:17 AM > > Subject: EJB in tomcat > > > > > > > hi, > > > > > > I would like to ask, can Tomcat work with Enterprise > > > Javabeans? 'cause I read from the Java site...it says that we > > need a > > > BEA server? Is it necessary? Or tomcat it self already has those > > > libraries. > > > > > > Anson > > > > > > > > > > > > - > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > --- > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: method of implementing a 'login' section in a site
Anson I would suggest using session tracking to keep track of this state. Place the user in your session and have a small function run in the head of your pages checking for this. If no username is found then call, session.invalidate and redirect the user back to the login screen. HTH Kind Regards Schalk Volume4 www.volume4.co.za Dedicated to an OpenSource World