Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigurationService"/> class.
 /// </summary>
 /// <param name="logger">Injected Logger Provider.</param>
 /// <param name="configuration">Injected Configuration Provider.</param>
 public ConfigurationService(
     ILogger <ConfigurationService> logger,
     IConfiguration configuration)
 {
     this.logger = logger;
     this.config = new Models.ExternalConfiguration();
     this.config = configuration.Get <Models.ExternalConfiguration>();
 }
 public void TestGetConfig()
 {
     Models.ExternalConfiguration expectedResult = new Models.ExternalConfiguration()
     {
         OpenIdConnect = new Models.OpenIdConnectConfiguration()
         {
             Authority    = "Authority",
             ClientId     = "ClientId",
             ResponseType = "ResponseType",
             Scope        = "Scope",
             Callbacks    = new Dictionary <string, System.Uri>
             {
                 { "Logon", new System.Uri("https://localhost/logon") },
                 { "Logout", new System.Uri("https://localhost/logout") },
             }
         },
         IdentityProviders = new Models.IdentityProviderConfiguration[]
         {
             new Models.IdentityProviderConfiguration()
             {
                 Id       = "Id",
                 Name     = "Name",
                 Icon     = "Icon",
                 Hint     = "Hint",
                 Disabled = true,
             }
         },
         WebClient = new Models.WebClientConfiguration()
         {
             LogLevel = "LogLevel",
             Timeouts = new Models.TimeOutsConfiguration()
             {
                 Idle           = 10000,
                 LogoutRedirect = "LogoutRedirect",
             },
             ExternalURLs = new Dictionary <string, System.Uri>
             {
                 {
                     "External", new System.Uri("https://localhost/external")
                 }
             }
         },
         ServiceEndpoints = new Dictionary <string, System.Uri>()
         {
             {
                 "Service", new System.Uri("https://localhost/service")
             }
         }
     };
     Models.ExternalConfiguration actualResult = service.GetConfiguration();
     Assert.True(expectedResult.IsDeepEqual(actualResult));
 }
Exemple #3
0
 public Models.ExternalConfiguration Index()
 {
     Models.ExternalConfiguration config = this.configservice.GetConfiguration();
     config.WebClient.ClientIP = this.HttpContext.Connection.RemoteIpAddress?.MapToIPv4().ToString();
     return(config);
 }