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

Return types are too strict #412

Open
cicalese opened this issue Apr 6, 2024 · 0 comments · May be fixed by #415
Open

Return types are too strict #412

cicalese opened this issue Apr 6, 2024 · 0 comments · May be fixed by #415

Comments

@cicalese
Copy link
Collaborator

cicalese commented Apr 6, 2024

#327 introduced several return types that are too strict. Some examples,

Sometimes an identity provider will return an opaque access token. When an attempt is made to json_decode the JWT, null is returned. This gives the following exception when an attempt is made to retrieve the access token payload (seen when authenticating with Google):

TypeError: Return value of Jumbojett\OpenIDConnectClient::decodeJWT() must be an instance of stdClass, null returned
Backtrace:
from /var/www/mediawiki/w/extensions/OpenIDConnect/vendor/jumbojett/openid-connect-php/src/OpenIDConnectClient.php(1231)
#0 /var/www/mediawiki/w/extensions/OpenIDConnect/vendor/jumbojett/openid-connect-php/src/OpenIDConnectClient.php(1751): Jumbojett\OpenIDConnectClient->decodeJWT()
#1 /var/www/mediawiki/w/extensions/OpenIDConnect/includes/OpenIDConnect.php(306): Jumbojett\OpenIDConnectClient->getAccessTokenPayload()

Sometimes an identity provider will not return a refresh token. In this case, $this->refreshToken is never changed from the default value of null. This gives the following exception when an attempt is made to retrieve the refresh token (seen when authenticating with Microsoft):

TypeError: Return value of Jumbojett\OpenIDConnectClient::getRefreshToken() must be of the type string, null returned
Backtrace:
from /var/www/mediawiki/w/extensions/OpenIDConnect/vendor/jumbojett/openid-connect-php/src/OpenIDConnectClient.php(1732)
#0 /var/www/mediawiki/w/extensions/OpenIDConnect/includes/OpenIDConnect.php(323): Jumbojett\OpenIDConnectClient->getRefreshToken()
@hexmode hexmode linked a pull request Apr 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant