Skip to content

Need to pass Idaas\OpenID\ResponseTypes\BearerTokenResponse to AuthorizationServer constructor. #32

@mricherzhagen

Description

@mricherzhagen

If the Idaas\OpenID\ResponseTypes\BearerTokenResponse is not passed to the AuthorizationServer constructor as the responseType the $result will be a League\OAuth2\Server\ResponseTypes\BearerTokenResponse and not a Idaas\OpenID\ResponseTypes\BearerTokenResponse (The @var is also wrong):

/**
* @var BearerTokenResponse $result
*/
$result = parent::respondToAccessTokenRequest($request, $responseType, $accessTokenTTL);

The League BearerTokenResponse does not have the setIdToken method, so it crashes here:

$result->setIdToken($idToken);

This should be probably fixed in the README and a proper type-assert should be added to the AuthCodeGrant.

 // Setup the authorization server
 $server = new \League\OAuth2\Server\AuthorizationServer(
     $clientRepository,
     $accessTokenRepository,
     $scopeRepository,
     $privateKey,
-    $encryptionKey
+    $encryptionKey,
+    new \Idaas\OpenID\ResponseTypes\BearerTokenResponse,
 );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions