Skip to content

Commit 0516761

Browse files
committed
feat: Split resource_scopes per resource for error responses
1 parent 72c29e6 commit 0516761

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

packages/uma/src/ticketing/strategy/ImmediateAuthorizerStrategy.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,9 @@ export class ImmediateAuthorizerStrategy implements TicketingStrategy {
6767
}
6868

6969
if (unmatchedPermissions.length > 0) {
70-
// TODO: due to the current format, scopes are not linked to resources,
71-
// so this will be weird for requests with multiple target resources.
72-
return Failure([{
73-
resource_scopes: unmatchedPermissions.flatMap((perm) => perm.resource_scopes),
74-
}]);
70+
// TODO: RequiredClaim has no field indicating for which the scopes are missing, could add one.
71+
// The resource_scopes field itself is already custom (added because of aggregation spec)
72+
return Failure(unmatchedPermissions.map((perm) => ({ resource_scopes: perm.resource_scopes })));
7573
}
7674

7775
return Success(permissions);

0 commit comments

Comments
 (0)