BearerTokenValidator:validateAuthorization seems to incorrectly use the audience claim.
// Return the request with additional attributes return $request ->withAttribute('oauth_access_token_id', $token->getClaim('jti')) ->withAttribute('oauth_client_id', $token->getClaim('aud')) ->withAttribute('oauth_user_id', $token->getClaim('sub')) ->withAttribute('oauth_scopes', $token->getClaim('scopes'));
The appears to expect the client identifier as audience which seems to conflict with the bearer spec here. It's possible I am misunderstanding this spec as it is possible to reject a token based on the relationship between client_id and authorization server but that is not clear to me.
https://tools.ietf.org/html/draft-ietf-oauth-jwt-bearer-12#section-3
- The JWT MUST contain an "aud" (audience) claim containing a value that identifies the authorization server as an intended audience. The token endpoint URL of the authorization server MAY be used as a value for an "aud" element to identify the authorization server as an intended audience of the JWT. The Authorization Server MUST reject any JWT that does not contain its own identity as the intended audience In the absence of an application profile specifying otherwise, compliant applications MUST compare the audience values using the Simple String Comparison method defined in Section 6.2.1 of RFC 3986 [RFC3986]. As noted in Section 5, the precise strings to be used as the audience for a given Authorization Server must be configured out-of-band by the Authorization Server and the Issuer of the JWT.
Source: thephpleague/oauth2-server