Skip to content

Commit

Permalink
fix: await the result returned by resourceIndicators.useGrantedResour…
Browse files Browse the repository at this point in the history
…ce function, in resolve_resource.js

Since the useGrantedResource function can be async function (in fact the default value is indeed async function), the result of calling it must be awaited.
Or, !! a Promise object always return true.
  • Loading branch information
Starrah committed Jan 3, 2022
1 parent 2ba8395 commit c35396a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/helpers/resolve_resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = async (ctx, model, config, scopes = model.scopes) => {
case !model.resource:
case Array.isArray(model.resource) && model.resource.length === 0:
break;
case model.resource && !!config.resourceIndicators.useGrantedResource(ctx, model):
case model.resource && !!(await config.resourceIndicators.useGrantedResource(ctx, model)):
case !ctx.oidc.params.resource && (!config.userinfo.enabled || !scopes.has('openid')):
resource = model.resource;
break;
Expand Down

0 comments on commit c35396a

Please sign in to comment.