- invalid username
- Incorrect password
You should not distinguish between these two cases. This creates an information leak for the attacker, reducing his search space as soon as he finds a valid username. You just have to say “invalid username and password combination” or the like.
- does not have an account in the database
This is identical to (1).
- The account in the database is inactive.
This again should not be distinguished as indicated above.
- The database account does not have the required roles.
This is not a login failure. This becomes a denial of access when the user does something that requires a missing role, or it causes the user interface to not display actions for the missing roles.
The decision made to pass the appropriate JAAS errors to the application was to add them as the public Subject credentials.
source share