Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Security] InMemoryUserProvider now concerns whether user's password is changed when refreshing #13627

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

Merged
merged 1 commit into from
Oct 5, 2015

Conversation

issei-m
Copy link
Contributor

@issei-m issei-m commented Feb 9, 2015

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

When a user has changed own password, I want to logout any sessions which is authenticated by its user except changer itself.

DaoAuthenticationManager::checkAuthentication() method seems to concern about it.

But, this situation actually never happens because both users that will be passed to this method are always identical in re-authentication.
It's because the token refreshes own user via ContextListener before re-authentication.

}

$user = $this->users[strtolower($username)];
$storedUser = $this->getUser($username);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about keeping the original $user variable and keep the next line identical to what it was before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this?

public function loadUserByUsername($username)
{
    $user = $this->getUser($username);

    return new User($user->getUsername(), $user->getPassword(), $user->getRoles(), $user->isEnabled(), $user->isAccountNonExpired(), $user->isCredentialsNonExpired(), $user->isAccountNonLocked());
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@issei-m I think so

@issei-m issei-m force-pushed the in-memory-user-provider branch from debb422 to 729902a Compare August 10, 2015 13:08
@issei-m
Copy link
Contributor Author

issei-m commented Aug 10, 2015

@fabpot @aitboudad Thanks for your reviewing! Now I updated PR and rebased onto 2.3 branch.

@fabpot
Copy link
Member

fabpot commented Oct 5, 2015

Thank you @issei-m.

@fabpot fabpot merged commit 729902a into symfony:2.3 Oct 5, 2015
fabpot added a commit that referenced this pull request Oct 5, 2015
…s password is changed when refreshing (issei-m)

This PR was merged into the 2.3 branch.

Discussion
----------

[Security] InMemoryUserProvider now concerns whether user's password is changed when refreshing

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

When a user has changed own password, I want to logout any sessions which is authenticated by its user except changer itself.

[DaoAuthenticationManager::checkAuthentication()](https://github.com/symfony/symfony/blob/2.3/src/Symfony/Component/Security/Core/Authentication/Provider/DaoAuthenticationProvider.php#L59) method seems to concern about it.

But, this situation actually never happens because both users that will be passed to this method are always identical in re-authentication.
It's because the token refreshes own user via [ContextListener](https://github.com/symfony/symfony/blob/2.3/src/Symfony/Component/Security/Http/Firewall/ContextListener.php#L90) before re-authentication.

Commits
-------

729902a [Security] InMemoryUserProvider now concerns whether user's password is changed when refreshing
@issei-m issei-m deleted the in-memory-user-provider branch October 5, 2015 15:23
This was referenced Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants