Scope-parameter is required in some cases with client_credentials grant

Description

When client_credentials grant is used at the token endpoint, the ValidateScope action may throw an NPE if the request doesn’t contain scope attribute:

ERROR [net.shibboleth.idp.plugin.oidc.op.profile:-2] - Uncaught runtime exception java.lang.NullPointerException: Cannot invoke "com.nimbusds.oauth2.sdk.Scope.iterator()" because "requestedScopes" is null at net.shibboleth.idp.plugin.oidc.op.oauth2.profile.impl.ValidateScope.doExecute(ValidateScope.java:221)

This happens when the function for allowed scopes returns a non-empty value. That’s the case for instance when the registered metadata contains some scopes.

This is clearly a bug, as the spec RFC 6749: The OAuth 2.0 Authorization Framework allows scope to be missing, as it’s specified optional in 4.4.2.

Environment

None

Activity

Henri Mikkonen 
February 16, 2024 at 8:06 AM

Fixed in 7ff4e96d385993bb4f9c895385c64c523c91ba4c

Fixed

Details

Assignee

Reporter

Fix versions

Created September 29, 2023 at 12:48 PM
Updated June 5, 2024 at 12:55 PM
Resolved February 16, 2024 at 8:06 AM