public void Configure(string name, JwtBearerOptions options)
        {
            var definitions = _localApiDescriptor.GetResourceDefinitions();

            if (!definitions.ContainsKey(_apiName))
            {
                return;
            }

            if (string.Equals(name, _scheme, StringComparison.Ordinal))
            {
                options.Events = options.Events ?? new JwtBearerEvents();
                options.Events.OnMessageReceived = ResolveAuthorityAndKeysAsync;
                options.Audience = _apiName;

                var staticConfiguration = new OpenIdConnectConfiguration
                {
                    Issuer = options.Authority
                };

                var manager = new StaticConfigurationManager(staticConfiguration);
                options.ConfigurationManager = manager;
                options.TokenValidationParameters.ValidIssuer   = options.Authority;
                options.TokenValidationParameters.NameClaimType = "name";
                options.TokenValidationParameters.RoleClaimType = "role";
            }
        }
    internal IEnumerable <ApiResource> GetApiResources()
    {
        var data = _configuration
                   .Get <Dictionary <string, ResourceDefinition> >();

        if (data != null)
        {
            foreach (var kvp in data)
            {
                _logger.LogInformation(LoggerEventIds.ConfiguringAPIResource, "Configuring API resource '{ApiResourceName}'.", kvp.Key);
                yield return(GetResource(kvp.Key, kvp.Value));
            }
        }

        var localResources = _localApiDescriptor?.GetResourceDefinitions();

        if (localResources != null)
        {
            foreach (var kvp in localResources)
            {
                _logger.LogInformation(LoggerEventIds.ConfiguringLocalAPIResource, "Configuring local API resource '{ApiResourceName}'.", kvp.Key);
                yield return(GetResource(kvp.Key, kvp.Value));
            }
        }
    }