8000 [Ldap] Make LdapUserProvider::refreshUser() actually reload the user entry by Mathieudewet · Pull Request #33246 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Ldap] Make LdapUserProvider::refreshUser() actually reload the user entry #33246

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Symfony/Component/Ldap/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
-----

* Added the "extra_fields" option, an array of custom fields to pull from the LDAP server
* Fix the refresh method of the Ldap user provider according to symfony preconization.

4.3.0
-----
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Ldap/Security/LdapUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function refreshUser(UserInterface $user)
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
}

return new LdapUser($user->getEntry(), $user->getUsername(), $user->getPassword(), $user->getRoles());
return $this->loadUserByUsername($user->getUsername());
}

/**
Expand Down
12 changes: 12 additions & 0 deletions src/Symfony/Component/Ldap/Tests/Security/LdapUserProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,16 @@ public function testLoadUserByUsernameIsSuccessfulWithPasswordAttribute()
$provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com', null, null, [], 'sAMAccountName', '({uid_key}={username})', 'userpassword', ['email']);
$this->assertInstanceOf(LdapUser::class, $provider->loadUserByUsername('foo'));
}

public function testRefreshSendUnsupportedUserExceptionWhenProvidedUserIsNotLdapUserOne() {
// Todo
}

public function testRefreshIsSuccessFullWhenLdapUserIsTheSameAsSessionOne() {
// Todo
}

public function testRefreshFailsWhenLdapUserIsNotTheSameAsSessionOne() {
// Todo
}
}
0