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

Prevent fatal error in loadUserByOAuthUserResponse() when nickname is not available in OAuth response #1913

Merged
merged 1 commit into from
Aug 20, 2023
Merged
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Changelog
* Bugfix: Added `OAuth1ResourceOwner` & `OAuth2ResourceOwner` to cover case of implementing custom oauth resource owners,
* Bugfix: Fixed Authorization Header in `CleverResourceOwner::doGetRequest`,
* Bugfix: Catch also the `TransportExceptionInterface` in `AbstractResourceOwner::getResponseContent()` method,
* Bugfix: Current matched Firewall is respected during generation of resource owner check path links.
* Bugfix: Current matched Firewall is respected during generation of resource owner check path links,
* Bugfix: Prevent fatal error in `OAuthUserProvider::loadUserByOAuthUserResponse()` when `nickname` is not available in OAuth response.

## 2.0.0-BETA2 (2022-01-16)
* Deprecated: configuration parameter `firewall_names`, firewalls are now computed automatically - all firewalls that have defined `oauth` authenticator/provider will be collected,
Expand Down
2 changes: 1 addition & 1 deletion src/Security/Core/User/OAuthUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function loadUserByUsername($username)

public function loadUserByOAuthUserResponse(UserResponseInterface $response): UserInterface
{
return $this->loadUserByIdentifier($response->getNickname());
return $this->loadUserByIdentifier($response->getNickname() ?: $response->getUserIdentifier());
}

public function refreshUser(UserInterface $user): UserInterface
Expand Down