Skip to content

Latest commit

 

History

History
21 lines (19 loc) · 730 Bytes

dynamic_op_scope.md

File metadata and controls

21 lines (19 loc) · 730 Bytes

Accepting Dynamic OP Scope Values

  • built for version: ^7.1.2
  • For dynamic scopes at the Resource Server you'd use the helpers in the resourceIndicators feature.
// our dynamic scope is in the format "dynamic:{3 digits}"
const requestParamOIDCScopes = Object.getOwnPropertyDescriptor(provider.OIDCContext.prototype, 'requestParamOIDCScopes').get;
Object.defineProperty(provider.OIDCContext.prototype, 'requestParamOIDCScopes', {
  get() {
    const scopes = this.requestParamScopes;
    const recognizedScopes = requestParamOIDCScopes.call(this);
    for (const scope of scopes) {
      if (/^dynamic:\d{3}$/.exec(scope)) {
        recognizedScopes.add(scope);
      }
    }
    return recognizedScopes;
  },
});