aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-02-28 13:14:23 +0200
committertranstrike <transtrike@gmail.com>2021-02-28 13:14:23 +0200
commit2a85613d6827f5a1d151b856739863fbe9782143 (patch)
treee66cdc9b8a64b37ef6fb8719b0a8d0a2e2102e54
parent26b18fe3727507d1b47ffb53ed773f133122eee8 (diff)
downloadDevHive-2a85613d6827f5a1d151b856739863fbe9782143.tar
DevHive-2a85613d6827f5a1d151b856739863fbe9782143.tar.gz
DevHive-2a85613d6827f5a1d151b856739863fbe9782143.zip
Removed JwtOptions
-rw-r--r--src/Services/DevHive.Services/Options/JwtOptions.cs14
-rw-r--r--src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs14
-rw-r--r--src/Web/DevHive.Web/appsettings.json3
3 files changed, 4 insertions, 27 deletions
diff --git a/src/Services/DevHive.Services/Options/JwtOptions.cs b/src/Services/DevHive.Services/Options/JwtOptions.cs
deleted file mode 100644
index d973f45..0000000
--- a/src/Services/DevHive.Services/Options/JwtOptions.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Microsoft.Extensions.Options;
-
-namespace DevHive.Services.Options
-{
- public class JwtOptions
- {
- public JwtOptions(string secret)
- {
- this.Secret = secret;
- }
-
- public string Secret { get; init; }
- }
-}
diff --git a/src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs b/src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs
index 8d387bd..18127bc 100644
--- a/src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs
+++ b/src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs
@@ -1,6 +1,5 @@
using System.Text;
using System.Threading.Tasks;
-using DevHive.Services.Options;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@@ -12,15 +11,10 @@ namespace DevHive.Web.Configurations.Extensions
{
public static void JWTConfiguration(this IServiceCollection services, IConfiguration configuration)
{
- services.AddSingleton(new JwtOptions(configuration
- .GetSection("AppSettings")
- .GetSection("Secret")
- .Value));
-
// Get key from appsettings.json
- var key = Encoding.ASCII.GetBytes(configuration
- .GetSection("AppSettings")
- .GetSection("Secret")
+ var signingKey = Encoding.ASCII.GetBytes(configuration
+ .GetSection("Jwt")
+ .GetSection("signingKey")
.Value);
// Setup Jwt Authentication
@@ -42,7 +36,7 @@ namespace DevHive.Web.Configurations.Extensions
x.SaveToken = true;
x.TokenValidationParameters = new TokenValidationParameters
{
- IssuerSigningKey = new SymmetricSecurityKey(key),
+ IssuerSigningKey = new SymmetricSecurityKey(signingKey),
ValidateIssuer = false,
ValidateAudience = false
};
diff --git a/src/Web/DevHive.Web/appsettings.json b/src/Web/DevHive.Web/appsettings.json
index b7e0ce5..fcf9805 100644
--- a/src/Web/DevHive.Web/appsettings.json
+++ b/src/Web/DevHive.Web/appsettings.json
@@ -1,7 +1,4 @@
{
- "AppSettings": {
- "Secret": ""
- },
"Jwt": {
"signingKey": "",
"validationIssuer": "",