public DefaultSnClientRequestParametersProvider(ClientStore clientStore, IOptions <ClientRequestOptions> clientOptions, IOptions <AuthenticationOptions> authOptions) { var crOptions = clientOptions?.Value ?? new ClientRequestOptions(); var authority = authOptions?.Value?.Authority ?? string.Empty; // load admin ui clients from db using ClientStore var clients = clientStore.GetClientsByAuthorityAsync(authority).GetAwaiter().GetResult() .Where(c => c.Type.HasFlag(ClientType.AdminUi)) .Select(c => new SnIdentityServerClient { ClientType = ClientAdminUi, ClientId = c.ClientId }).ToList(); // add clients from config clients.AddRange(crOptions.Clients); // add default clients only if their type is missing if (clients.All(c => c.ClientType != ClientAdminUi)) { clients.Add(new SnIdentityServerClient { ClientType = ClientAdminUi, ClientId = ClientAdminUi }); } if (clients.All(c => c.ClientType != ClientTool)) { clients.Add(new SnIdentityServerClient { ClientType = ClientTool, ClientId = ClientTool }); } foreach (var client in clients) { // duplicate client types will overwrite older values silently if (_parameters.ContainsKey(client.ClientType)) { SnTrace.System.Write($"DefaultSnClientRequestParametersProvider: client type {client.ClientType} is " + $"already registered, the new value ({client.ClientId} will overwrite it.)"); } _parameters[client.ClientType] = new ReadOnlyDictionary <string, string>(new Dictionary <string, string> { { "authority", authority }, { "client_id", client.ClientId } }); } }