• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

designing a authentication mechanism

 
pendse anagha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
I am designing a system which is supposed to be shared across multiple applications .

While authenticating - I am supposed to check :

1 >Is the user present in the database
2 >Is the user active ( "status" field in database )
3 >Is the application active ( "status" field in database )

So one approach I was thinking was -
I would always get a Value Object ( DTO )
This object would have attributes such as -
"isAppPresent" , "isAppActive" , "isUserPresent" , "isUserActive" etc

Based on these attribute values - I would display the appropriate message on the UI

The other option is - write three exception classes - "ApplicationInactive" , "UserInactive" etc

Was wondering - should I throw exceptions and based on my exception logic deal with the situation or look at my Value Object attributes and take a decision ?

Thanks in advance ,
-anagha
 
Vishnu Ramesh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi anagha,


If you would like to inform the caller, better to go for exceptions. But since you said you will be handling the decision, which implies internal to the component or application, I suggest you to use the ValueObject method.


regards,
Vishnu
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the client going to DO anything different based on all these booleans? If it's only going to display different messages, why make the client interpret them at all. Maybe just return one authenticated boolean and a message.

Even that might be too much.

Any of that sound interesting?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic