Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Design Patter for the login process

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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

}
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic