public DefaultSnClientRequestParametersProvider(SnClientRequestOptions options)
 {
     foreach (var client in options.Clients)
     {
         _parameters.Add(client.ClientType, new ReadOnlyDictionary <string, string>(new Dictionary <string, string>
         {
             { "authority", options.Authority },
             { "client_id", client.ClientId }
         }));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Adds custom IdentityServer client definitions for multi-repository clients.
        /// If not sure, use the <see cref="AddDefaultSenseNetIdentityServerClients"/> method instead.
        /// </summary>
        /// <remarks>
        /// This method does not add the default client, developers need to add it
        /// manually if necessary.
        /// </remarks>
        /// <param name="appBuilder">The <see cref="AuthenticationBuilder"/> instance.</param>
        /// <param name="configureOptions">Configure method.</param>
        public static AuthenticationBuilder AddSenseNetIdentityServerClients(this AuthenticationBuilder appBuilder,
                                                                             Action <SnClientRequestOptions> configureOptions)
        {
            var options = new SnClientRequestOptions();

            configureOptions(options);

            appBuilder.Services.AddSingleton(typeof(ISnClientRequestParametersProvider),
                                             new DefaultSnClientRequestParametersProvider(options));

            return(appBuilder);
        }