• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Design Patter for the login process

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a JSP which reads the user name and password and redirects to class which authenticates the user. Here, the authentication will be done by one of the two different servers. The class needs to decide which server to call. Is there any good design to follow ?

Thanks in Advance.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How does the class know which server to call?

Without having further information, you might want to take a look at the Chain Of Responsibility pattern.
 
Swosti Dipan Pal
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, the class is having only the user name and password. What I am trying to do is find out a specific key=value pair from a properties file. Depending on that it will choose the server.

Please let me know if you have any better idea.

Thanks a lot !
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I still don't understand how, only having username and password, you decide which server to use. Could you please elaborate, perhaps with an example? Thanks.
 
Swosti Dipan Pal
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry. I should have giving the implementation pseuduo code earlier.

pseudo code:

//get the username and password

//check for the properties file for a specific key ( willAuth = Yes)- if Yes , data will be sent to server 1

if (found){
//Pass the credential to the server 1
if (Authenticated){
//set ldapAuth = true;
}
else{
//set mySqlAuth = flase;
}
}
...

if (mySqlAuth == false){
//send the credential to Server 2
//set mySqlAuth = true;
}

if ( ldapAuth = true || mySqlAuth = true){

// do this common task

}
 
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic