From 289eec8eea39e4c7273d81630dd84ac3fe0087a2 Mon Sep 17 00:00:00 2001 From: Aaron Cooper Date: Tue, 30 Jan 2024 01:30:59 +0000 Subject: [PATCH] . --- Example/docker-compose.yml | 1 + README.md | 9 +++++---- .../Topica.Server/Controllers/LoginController.cs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Example/docker-compose.yml b/Example/docker-compose.yml index ddeb145..6d43aa2 100644 --- a/Example/docker-compose.yml +++ b/Example/docker-compose.yml @@ -7,6 +7,7 @@ services: ports: - 8080:8080 environment: + SecretKey: "YourSecretfrsfwafawfwafwfafwfawftKey" DbType: InMemory DbConnectionString: volumes: diff --git a/README.md b/README.md index 5083391..11d8328 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,11 @@ Rights to contribution made is transfered to repo owner immediately upon submiss ### Env Variables -| name | Description | Options | -| ----------------------------- | ------------------------------------------ | ------------------------------------- | -| DbType | Db type used to store app data | Postgres, SqlServer, Sqlite, InMemory | -| DbConnectionString (Optional) | Db connection string for none in-memory Db | | +| name | Description | Options | +| ----------------------------- | --------------------------------------------------------------- | ------------------------------------- | +| SecretKey | Secret string used for creating Symmetric Security Key at login | `random long string` | +| DbType | Db type used to store app data | Postgres, SqlServer, Sqlite, InMemory | +| DbConnectionString (Optional) | Db connection string for none in-memory Db | | ### Auth Config (auth.config.json) diff --git a/Source/Topica.Server/Topica.Server/Controllers/LoginController.cs b/Source/Topica.Server/Topica.Server/Controllers/LoginController.cs index 3325401..c12df60 100644 --- a/Source/Topica.Server/Topica.Server/Controllers/LoginController.cs +++ b/Source/Topica.Server/Topica.Server/Controllers/LoginController.cs @@ -48,7 +48,7 @@ public async Task Login(string username, string password, { claims.Add(new Claim(ClaimTypes.Role, role)); } - var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["SecretKey"])); + var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration.GetValue("SecretKey"))); var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); var token = new JwtSecurityToken(