• Post Reply Bookmark Topic Watch Topic
  • New Topic

Design Patter for the login process  RSS feed

 
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
Sheriff
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
Sheriff
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

}
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!