Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEC-537: Allow customized account status checking in AbstractUserDetailsAuthenticationProvider.authenticate method #798

Closed
spring-projects-issues opened this issue Aug 27, 2007 · 4 comments
Labels
in: core An issue in spring-security-core type: enhancement A general enhancement type: jira An issue that was migrated from JIRA
Milestone

Comments

@spring-projects-issues
Copy link

Gerr Magnus Mes(Migrated from SEC-537) said:

Methods isAccountNonLocked(), isEnabled(), isAccountNonExpired() are invoked before checking credentials (before additionalAuthenticationChecks). So I can get any user status (locked, disabled, etc) even if I don’t now user credentials.

@spring-projects-issues
Copy link
Author

Luke Taylor said:

This isn’t the case. It’s up to you what failure message you show to the user when a login fails – there’s nothing to stop you saying “login failed” regardless of the cause. It’s also not uncommon for applications to inform a user that their account has been locked after a fixed number of login attempts. The desired behaviour will depend on exactly how you interpret the different status flags (which is not strictly defined by the framework). The exceptions also drive the generation of events by the AuthenticationManager, so they are not necessarily there for user consumption at all. A sysadmin may want to be informed anytime someone is trying to use a locked or disabled account, for example, not just when they use the correct password.

It can also be argued that checking the password before the account locked status and showing a “locked” message only when a correct password is given would also allow brute-force password checking even after the account has been locked.

So I disagree that the behaviour is “incorrect”. I think it might be useful to be able to customize things though. Perhaps we should have methods

preAuthenticationChecks(UserDetails user)

postAuthentication(UserDetails user)

which could be overridden to alter when the differed flags are checked.

@spring-projects-issues
Copy link
Author

Ben Alex said:

Luke, the description you provided in the second paragraph is the precise reason why the flags are checked before the password (ie avoidance of brute-force). I am not of the view it is necessary to provide protected methods to customize this behavior, as doing so seems likely to lead to less security and complicate our abstract class for little potential benefit. If you’re in agreement, please close the issue as “won’t fix”.

@spring-projects-issues
Copy link
Author

Luke Taylor said:

We’ve decided to allow customization here by way of two pluggable strategies, as described in SEC-536. This will cater for situations where the status flags are interpreted differently (e.g. accounts are suspended temporarily for administratve reasons) or where an organization insists on a particular policy regardless.

@spring-projects-issues
Copy link
Author

Luke Taylor said:

AbstractUserdetailsAutheticationProvider now as two UserDetailsChecker strategies:

preAuthenticationChecks

postAuthenticationChecks

which can be injected. The default implementations follow the original behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core An issue in spring-security-core type: enhancement A general enhancement type: jira An issue that was migrated from JIRA
Projects
None yet
Development

No branches or pull requests

2 participants
@spring-projects-issues and others