dev
Line | |
---|
1 | using Microsoft.Extensions.Configuration;
|
---|
2 | using FinkiChattery.Identity.Contracts.AppSettings;
|
---|
3 | using System.Collections.Generic;
|
---|
4 |
|
---|
5 | namespace FinkiChattery.Identity.Services
|
---|
6 | {
|
---|
7 | public class AppSettings
|
---|
8 | {
|
---|
9 | public AppSettings(IConfiguration configuration)
|
---|
10 | {
|
---|
11 | Configuration = configuration;
|
---|
12 | }
|
---|
13 |
|
---|
14 | public CorsSettings CorsSettings {
|
---|
15 | get
|
---|
16 | {
|
---|
17 | var cors = new CorsSettings();
|
---|
18 | Configuration.GetSection("app:corsSettings").Bind(cors);
|
---|
19 | return cors;
|
---|
20 | }
|
---|
21 | }
|
---|
22 |
|
---|
23 | public IdentityServerSettings IdentityServerSettings {
|
---|
24 | get
|
---|
25 | {
|
---|
26 | var identitySettings = new IdentityServerSettings();
|
---|
27 | var apiResourceSettings = new List<ApiResourceSettings>();
|
---|
28 | var clientsSettings = new List<ClientsSettings>();
|
---|
29 | var apiScopesSettings = new List<ApiScopesSettings>();
|
---|
30 |
|
---|
31 | Configuration.GetSection("app:identityServerSettings:apiResources").Bind(apiResourceSettings);
|
---|
32 | Configuration.GetSection("app:identityServerSettings:clients").Bind(clientsSettings);
|
---|
33 | Configuration.GetSection("app:identityServerSettings:apiScopes").Bind(apiScopesSettings);
|
---|
34 |
|
---|
35 | identitySettings.ApiResourceSettings = apiResourceSettings;
|
---|
36 | identitySettings.ClientsSettings = clientsSettings;
|
---|
37 | identitySettings.ApiScopesSettings = apiScopesSettings;
|
---|
38 |
|
---|
39 | return identitySettings;
|
---|
40 | }
|
---|
41 | }
|
---|
42 |
|
---|
43 | private IConfiguration Configuration { get; }
|
---|
44 | }
|
---|
45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.