Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Single Login

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
Kindly advice some technique or procedure on this matter. Im currently working on a web program using jsp . The web application requires user's login and information being taken are the usual username and password. I need to ensure that the user can only only login once in any terminal. For example I login on terminal A as SUPERMAN and login again on terminal B as SUPERMAN . The program should be able to detect if superman has already logon if it is then superman will not permited to login again.
Kindly advice me on this matter. Your help will be highly apreciated.
thanks
Harry
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What resources will you have at your disposal?
How critical is it?
Does it matter if they cannot log on at all when failing to log out properly without having their accounts reset?
etc. etc. etc.
There's many possible solutions, most resolving around keeping track of who's logged in from where in some way.
 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Harry Pattern:
hi,
Kindly advice some technique or procedure on this matter. Im currently working on a web program using jsp . The web application requires user's login and information being taken are the usual username and password. I need to ensure that the user can only only login once in any terminal. For example I login on terminal A as SUPERMAN and login again on terminal B as SUPERMAN . The program should be able to detect if superman has already logon if it is then superman will not permited to login again.
Kindly advice me on this matter. Your help will be highly apreciated.
thanks
Harry


You may use ServletContext to store the login id (or some unique identifier), once user is in and remove it on log out.
Before login any user always check if his login id is present in servlet context. If it is, then don't allow user else allow him.
This may not work in case your application is distributed in multiple jvm's.
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you want to create single signon system, i think, u must be use as same as Directory Service and access with JNDI API.
 
Harry Pattern
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Harry Pattern:
hi,
Kindly advice some technique or procedure on this matter. Im currently working on a web program using jsp . The web application requires user's login and information being taken are the usual username and password. I need to ensure that the user can only only login once in any terminal. For example I login on terminal A as SUPERMAN and login again on terminal B as SUPERMAN . The program should be able to detect if superman has already logon if it is then superman will not permited to login again.
Kindly advice me on this matter. Your help will be highly apreciated.
thanks
Harry

 
Harry Pattern
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im using tomcat 4.1 webserver and programs written in jsp. Is there a way where I can create an object on the server side . And the object should be running as long as the tomcat 4.1 webserver is running.
Thanks
harry
 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use a JavaBean with application scope, so it will persist as long as the server is running.

Or, if you're using a database system which maintains user accounts, you can always have a flag to monitor if the user is logged in.
WS
 
Harry Pattern
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The idea of persisting while the server is running is a great idea. But can you guys give me a code snippet on how to do this .
Thanks
 
Winston Smith
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code to make a JavaBean persist while the server is running is in my previous post. You basically declare a bean and set its scope to "application". You may also set the scope to "session", in which case the bean will persist throughout a client's session only.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Though using a bean in the application context is the way to go, there are some obstacles to manage seamless session management.
If SUPERMAN logs in from MACHINE A, and abruptly closes the browser. Still, he is logically accessing the system.So, till the session times-out, he cannot access the system again.
Alternatively, you can try to invalidate the older session, if a new login happens with an existing user-id.
Hope this helps
Gowri shankar
 
Sheriff
Posts: 67592
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"vgowri",
We're pleased to have you here with us in the JSP forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Thanks!
bear
Forum Bartender
 
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic