Merge pull request #1548 from borjasanes/feature/identity-api-migration
identity api net 5 migration
This commit is contained in:
commit
3ce1b46b54
@ -1,8 +1,8 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles
|
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<UserSecretsId>aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5</UserSecretsId>
|
<UserSecretsId>aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5</UserSecretsId>
|
||||||
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||||
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
|
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class ConsentInputModel
|
public record ConsentInputModel
|
||||||
{
|
{
|
||||||
public string Button { get; set; }
|
public string Button { get; init; }
|
||||||
public IEnumerable<string> ScopesConsented { get; set; }
|
public IEnumerable<string> ScopesConsented { get; init; }
|
||||||
public bool RememberConsent { get; set; }
|
public bool RememberConsent { get; init; }
|
||||||
public string ReturnUrl { get; set; }
|
public string ReturnUrl { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,12 +1,10 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using IdentityServer4.Models;
|
using IdentityServer4.Models;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class ConsentViewModel : ConsentInputModel
|
public record ConsentViewModel : ConsentInputModel
|
||||||
{
|
{
|
||||||
public ConsentViewModel(ConsentInputModel model, string returnUrl, AuthorizationRequest request, Client client, Resources resources)
|
public ConsentViewModel(ConsentInputModel model, string returnUrl, AuthorizationRequest request, Client client, Resources resources)
|
||||||
{
|
{
|
||||||
@ -24,16 +22,16 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewMo
|
|||||||
ResourceScopes = resources.ApiResources.SelectMany(x => x.Scopes).Select(x => new ScopeViewModel(x, ScopesConsented.Contains(x.Name) || model == null)).ToArray();
|
ResourceScopes = resources.ApiResources.SelectMany(x => x.Scopes).Select(x => new ScopeViewModel(x, ScopesConsented.Contains(x.Name) || model == null)).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ClientName { get; set; }
|
public string ClientName { get; init; }
|
||||||
public string ClientUrl { get; set; }
|
public string ClientUrl { get; init; }
|
||||||
public string ClientLogoUrl { get; set; }
|
public string ClientLogoUrl { get; init; }
|
||||||
public bool AllowRememberConsent { get; set; }
|
public bool AllowRememberConsent { get; init; }
|
||||||
|
|
||||||
public IEnumerable<ScopeViewModel> IdentityScopes { get; set; }
|
public IEnumerable<ScopeViewModel> IdentityScopes { get; init; }
|
||||||
public IEnumerable<ScopeViewModel> ResourceScopes { get; set; }
|
public IEnumerable<ScopeViewModel> ResourceScopes { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ScopeViewModel
|
public record ScopeViewModel
|
||||||
{
|
{
|
||||||
public ScopeViewModel(Scope scope, bool check)
|
public ScopeViewModel(Scope scope, bool check)
|
||||||
{
|
{
|
||||||
@ -55,11 +53,11 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewMo
|
|||||||
Checked = check || identity.Required;
|
Checked = check || identity.Required;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; init; }
|
||||||
public string DisplayName { get; set; }
|
public string DisplayName { get; init; }
|
||||||
public string Description { get; set; }
|
public string Description { get; init; }
|
||||||
public bool Emphasize { get; set; }
|
public bool Emphasize { get; init; }
|
||||||
public bool Required { get; set; }
|
public bool Required { get; init; }
|
||||||
public bool Checked { get; set; }
|
public bool Checked { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class ForgotPasswordViewModel
|
public record ForgotPasswordViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
public string Email { get; set; }
|
public string Email { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class LoggedOutViewModel
|
public record LoggedOutViewModel
|
||||||
{
|
{
|
||||||
public string PostLogoutRedirectUri { get; set; }
|
public string PostLogoutRedirectUri { get; init; }
|
||||||
public string ClientName { get; set; }
|
public string ClientName { get; init; }
|
||||||
public string SignOutIframeUrl { get; set; }
|
public string SignOutIframeUrl { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class LoginViewModel
|
public record LoginViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class LogoutViewModel
|
public record LogoutViewModel
|
||||||
{
|
{
|
||||||
public string LogoutId { get; set; }
|
public string LogoutId { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -2,24 +2,24 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class RegisterViewModel
|
public record RegisterViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
[Display(Name = "Email")]
|
[Display(Name = "Email")]
|
||||||
public string Email { get; set; }
|
public string Email { get; init; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Password")]
|
[Display(Name = "Password")]
|
||||||
public string Password { get; set; }
|
public string Password { get; init; }
|
||||||
|
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Confirm password")]
|
[Display(Name = "Confirm password")]
|
||||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||||
public string ConfirmPassword { get; set; }
|
public string ConfirmPassword { get; init; }
|
||||||
|
|
||||||
public ApplicationUser User { get; set; }
|
public ApplicationUser User { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,22 +2,22 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class ResetPasswordViewModel
|
public record ResetPasswordViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
public string Email { get; set; }
|
public string Email { get; init; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
public string Password { get; set; }
|
public string Password { get; init; }
|
||||||
|
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Confirm password")]
|
[Display(Name = "Confirm password")]
|
||||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||||
public string ConfirmPassword { get; set; }
|
public string ConfirmPassword { get; init; }
|
||||||
|
|
||||||
public string Code { get; set; }
|
public string Code { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,14 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class SendCodeViewModel
|
public record SendCodeViewModel
|
||||||
{
|
{
|
||||||
public string SelectedProvider { get; set; }
|
public string SelectedProvider { get; init; }
|
||||||
|
|
||||||
public ICollection<SelectListItem> Providers { get; set; }
|
public ICollection<SelectListItem> Providers { get; init; }
|
||||||
|
|
||||||
public string ReturnUrl { get; set; }
|
public string ReturnUrl { get; init; }
|
||||||
|
|
||||||
public bool RememberMe { get; set; }
|
public bool RememberMe { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,20 +2,20 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
||||||
{
|
{
|
||||||
public class VerifyCodeViewModel
|
public record VerifyCodeViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public string Provider { get; set; }
|
public string Provider { get; init; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Code { get; set; }
|
public string Code { get; init; }
|
||||||
|
|
||||||
public string ReturnUrl { get; set; }
|
public string ReturnUrl { get; init; }
|
||||||
|
|
||||||
[Display(Name = "Remember this browser?")]
|
[Display(Name = "Remember this browser?")]
|
||||||
public bool RememberBrowser { get; set; }
|
public bool RememberBrowser { get; init; }
|
||||||
|
|
||||||
[Display(Name = "Remember me?")]
|
[Display(Name = "Remember me?")]
|
||||||
public bool RememberMe { get; set; }
|
public bool RememberMe { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ using IdentityServer4.Models;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models
|
||||||
{
|
{
|
||||||
public class ErrorViewModel
|
public record ErrorViewModel
|
||||||
{
|
{
|
||||||
public ErrorMessage Error { get; set; }
|
public ErrorMessage Error { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class AddPhoneNumberViewModel
|
public record AddPhoneNumberViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[Phone]
|
[Phone]
|
||||||
[Display(Name = "Phone number")]
|
[Display(Name = "Phone number")]
|
||||||
public string PhoneNumber { get; set; }
|
public string PhoneNumber { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,22 +2,22 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class ChangePasswordViewModel
|
public record ChangePasswordViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Current password")]
|
[Display(Name = "Current password")]
|
||||||
public string OldPassword { get; set; }
|
public string OldPassword { get; init; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "New password")]
|
[Display(Name = "New password")]
|
||||||
public string NewPassword { get; set; }
|
public string NewPassword { get; init; }
|
||||||
|
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Confirm new password")]
|
[Display(Name = "Confirm new password")]
|
||||||
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
||||||
public string ConfirmPassword { get; set; }
|
public string ConfirmPassword { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class ConfigureTwoFactorViewModel
|
public record ConfigureTwoFactorViewModel
|
||||||
{
|
{
|
||||||
public string SelectedProvider { get; set; }
|
public string SelectedProvider { get; init; }
|
||||||
|
|
||||||
public ICollection<SelectListItem> Providers { get; set; }
|
public ICollection<SelectListItem> Providers { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class FactorViewModel
|
public record FactorViewModel
|
||||||
{
|
{
|
||||||
public string Purpose { get; set; }
|
public string Purpose { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,16 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class IndexViewModel
|
public record IndexViewModel
|
||||||
{
|
{
|
||||||
public bool HasPassword { get; set; }
|
public bool HasPassword { get; init; }
|
||||||
|
|
||||||
public IList<UserLoginInfo> Logins { get; set; }
|
public IList<UserLoginInfo> Logins { get; init; }
|
||||||
|
|
||||||
public string PhoneNumber { get; set; }
|
public string PhoneNumber { get; init; }
|
||||||
|
|
||||||
public bool TwoFactor { get; set; }
|
public bool TwoFactor { get; init; }
|
||||||
|
|
||||||
public bool BrowserRemembered { get; set; }
|
public bool BrowserRemembered { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class SetPasswordViewModel
|
public record SetPasswordViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "New password")]
|
[Display(Name = "New password")]
|
||||||
public string NewPassword { get; set; }
|
public string NewPassword { get; init; }
|
||||||
|
|
||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Confirm new password")]
|
[Display(Name = "Confirm new password")]
|
||||||
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
||||||
public string ConfirmPassword { get; set; }
|
public string ConfirmPassword { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
||||||
{
|
{
|
||||||
public class VerifyPhoneNumberViewModel
|
public record VerifyPhoneNumberViewModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public string Code { get; set; }
|
public string Code { get; init; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[Phone]
|
[Phone]
|
||||||
[Display(Name = "Phone number")]
|
[Display(Name = "Phone number")]
|
||||||
public string PhoneNumber { get; set; }
|
public string PhoneNumber { get; init; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using IdentityServer4.EntityFramework.DbContexts;
|
using IdentityServer4.EntityFramework.DbContexts;
|
||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Identity.API;
|
||||||
using Microsoft.eShopOnContainers.Services.Identity.API.Data;
|
using Microsoft.eShopOnContainers.Services.Identity.API.Data;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
@ -11,15 +12,9 @@ using Serilog;
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API
|
string Namespace = typeof(Startup).Namespace;
|
||||||
{
|
string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
|
||||||
public class Program
|
|
||||||
{
|
|
||||||
public static readonly string Namespace = typeof(Program).Namespace;
|
|
||||||
public static readonly string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
|
|
||||||
|
|
||||||
public static int Main(string[] args)
|
|
||||||
{
|
|
||||||
var configuration = GetConfiguration();
|
var configuration = GetConfiguration();
|
||||||
|
|
||||||
Log.Logger = CreateSerilogLogger(configuration);
|
Log.Logger = CreateSerilogLogger(configuration);
|
||||||
@ -62,9 +57,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
|
|||||||
{
|
{
|
||||||
Log.CloseAndFlush();
|
Log.CloseAndFlush();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static IWebHost BuildWebHost(IConfiguration configuration, string[] args) =>
|
IWebHost BuildWebHost(IConfiguration configuration, string[] args) =>
|
||||||
WebHost.CreateDefaultBuilder(args)
|
WebHost.CreateDefaultBuilder(args)
|
||||||
.CaptureStartupErrors(false)
|
.CaptureStartupErrors(false)
|
||||||
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
|
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
|
||||||
@ -73,7 +67,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
|
|||||||
.UseSerilog()
|
.UseSerilog()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
private static Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
|
Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var seqServerUrl = configuration["Serilog:SeqServerUrl"];
|
var seqServerUrl = configuration["Serilog:SeqServerUrl"];
|
||||||
var logstashUrl = configuration["Serilog:LogstashgUrl"];
|
var logstashUrl = configuration["Serilog:LogstashgUrl"];
|
||||||
@ -88,7 +82,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
|
|||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IConfiguration GetConfiguration()
|
IConfiguration GetConfiguration()
|
||||||
{
|
{
|
||||||
var builder = new ConfigurationBuilder()
|
var builder = new ConfigurationBuilder()
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
@ -107,7 +101,3 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
|
|||||||
|
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user