Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit 8571a3d

Browse files
committed
eo
1 parent d38fdb6 commit 8571a3d

17 files changed

Lines changed: 782 additions & 122 deletions

src/.dockerignore renamed to .dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.env
33
.git
44
.gitignore
5-
.vs
5+
.vs/
66
.vscode
77
*/bin
88
*/obj
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
version: "3"
22
services:
33

4+
# #############################
5+
# # Database
6+
# #############################
7+
# redis:
8+
# image: redis:alpine
9+
# ports:
10+
# - "16379:6379"
11+
12+
413
#############################
514
# Database
615
#############################
@@ -39,7 +48,7 @@
3948
SQLSERVER_CONNECTION: "Server=database,1433;Initial Catalog=JpProject;Persist Security Info=False;User ID=sa;Password=@Password1;MultipleActiveResultSets=False;Connection Timeout=30;"
4049
ASPNETCORE_ENVIRONMENT: "Development"
4150
ISSUER_URI: "http://localhost:5000"
42-
# PUBLIC_URI: "http://localhost:5000"
51+
AMBIENT: "linux"
4352

4453
#############################
4554
# Management API
@@ -62,6 +71,7 @@
6271
ASPNETCORE_ENVIRONMENT: "Development"
6372
AUTHORITY: "http://sso:5000"
6473
VALIDATE_ISSUER: "false"
74+
AMBIENT: "linux"
6575

6676
#############################
6777
# User management UI

src/Backend/Jp.UserManagement/Properties/launchSettings.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
"launchBrowser": true,
2424
"launchUrl": "swagger/index.html",
2525
"environmentVariables": {
26-
"SQLSERVER_PORT": "1433",
27-
"SQLSERVER_HOST": "localhost",
28-
"SQLSERVER_PASSWORD": "@Password1",
2926
"ASPNETCORE_ENVIRONMENT": "Development"
3027
},
3128
"applicationUrl": "http://localhost:5003;https://localhost:5002"

src/Backend/Jp.UserManagement/Startup.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@
88
using Microsoft.AspNetCore.Hosting;
99
using Microsoft.Extensions.Configuration;
1010
using Microsoft.Extensions.DependencyInjection;
11+
using Microsoft.Extensions.Logging;
1112

1213
namespace Jp.UserManagement
1314
{
1415
public class Startup
1516
{
17+
private readonly ILogger<Startup> _logger;
1618
public IConfiguration Configuration { get; }
1719
public IHostingEnvironment HostEnvironment { get; }
1820

19-
public Startup(IHostingEnvironment hostEnvironment)
21+
public Startup(IHostingEnvironment hostEnvironment, ILogger<Startup> logger)
2022
{
23+
_logger = logger;
2124
var builder = new ConfigurationBuilder()
2225
.SetBasePath(hostEnvironment.ContentRootPath)
2326
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
@@ -42,25 +45,25 @@ public void ConfigureServices(IServiceCollection services)
4245
services.AddIdentity(Configuration);
4346
services.ConfigureCors();
4447

45-
46-
//services.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme)
48+
var authorityUri = Environment.GetEnvironmentVariable("AUTHORITY") ?? "http://localhost:5000";
49+
_logger.LogInformation($"Authority URI: {authorityUri}");
4750
services.AddAuthentication(options =>
4851
{
4952
options.DefaultAuthenticateScheme = IdentityServerAuthenticationDefaults.AuthenticationScheme;
5053
options.DefaultChallengeScheme = IdentityServerAuthenticationDefaults.AuthenticationScheme;
51-
54+
5255
})
5356
.AddIdentityServerAuthentication(options =>
5457
{
55-
options.Authority = Environment.GetEnvironmentVariable("AUTHORITY") ?? "http://localhost:5000";
58+
options.Authority = authorityUri;
5659
options.RequireHttpsMetadata = false;
5760
options.ApiSecret = "Q&tGrEQMypEk.XxPU:%bWDZMdpZeJiyMwpLv4F7d**w9x:7KuJ#fy,E8KPHpKz++";
5861
options.ApiName = "UserManagementApi";
5962

6063

6164
options.JwtBearerEvents.OnMessageReceived = (messae) =>
6265
{
63-
messae.Options.TokenValidationParameters.ValidateIssuer = bool.TryParse(Environment.GetEnvironmentVariable("VALIDATE_ISSUER") ?? "true", out _);
66+
messae.Options.TokenValidationParameters.ValidateIssuer = bool.Parse(Environment.GetEnvironmentVariable("VALIDATE_ISSUER") ?? "true");
6467
return Task.CompletedTask;
6568
};
6669
});

0 commit comments

Comments
 (0)