Allow symfony 6.4 and fixing condition for valid "0" responses#48
Closed
tecbird wants to merge 6 commits intomainick:mainfrom
Closed
Allow symfony 6.4 and fixing condition for valid "0" responses#48tecbird wants to merge 6 commits intomainick:mainfrom
tecbird wants to merge 6 commits intomainick:mainfrom
Conversation
throw exception only response is empty or null, in case of "0" it mest returned.
example:
$iamAdminClient->users()->count('test', $criteria)
=> no user found it will return 0 (valid case)
Owner
|
Thanks @tecbird and @Fahl-Design for the excellent work! |
mainick
requested changes
Nov 23, 2025
Owner
mainick
left a comment
There was a problem hiding this comment.
Add a new explicit method that returns the "raw" (array) representation instead of changing the userInfo signature.
I have suggested a change example.
- Interface — Add the new method (compatible with the rest of the interface):
// src/Interface/IamClientInterface.php
public function userInfoRaw(AccessTokenInterface $token): ?array;- Implementation — keep
userInfo, which always returns the DTO, and implementuserInfoRaw, which returns the raw array:
// src/Provider/KeycloakClient.php
/**
* @return array<string,mixed>|null
*/
public function userInfoRaw(AccessTokenInterface $token): ?array
{
try {
$this->verifyToken($token);
$accessToken = new AccessTokenLib([
'access_token' => $token->getToken(),
'refresh_token' => $token->getRefreshToken(),
'expires' => $token->getExpires(),
'values' => $token->getValues(),
]);
$resourceOwner = $this->keycloakProvider->getResourceOwner($accessToken);
$user = new KeycloakResourceOwner($resourceOwner->toArray(), $token);
$this->keycloakClientLogger->info('KeycloakClient::userInfoRaw', [
'user' => $user->toArray(),
]);
return $user->toArray();
}
catch (\Exception $e) {
$this->keycloakClientLogger->error('KeycloakClient::userInfoRaw', [
'error' => $e->getMessage(),
]);
return null;
}
}Here is a proposed change. Please feel free to adjust and improve it based on your expertise.
Owner
|
I took care of creating a release that includes the developments made by the contributors to this PR, incorporating the changes I requested #55 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
i found a bug for count api calls
$iamAdminClient->users()->count('test', $criteria) => no user found it will return 0 (valid case)symfony 6.4 should also work, we have some projects that are not currently at symfony 7.x