diff options
| author | transtrike <transtrike@gmail.com> | 2021-02-28 13:14:23 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-02-28 13:14:23 +0200 |
| commit | 2a85613d6827f5a1d151b856739863fbe9782143 (patch) | |
| tree | e66cdc9b8a64b37ef6fb8719b0a8d0a2e2102e54 /src/Web | |
| parent | 26b18fe3727507d1b47ffb53ed773f133122eee8 (diff) | |
| download | DevHive-2a85613d6827f5a1d151b856739863fbe9782143.tar DevHive-2a85613d6827f5a1d151b856739863fbe9782143.tar.gz DevHive-2a85613d6827f5a1d151b856739863fbe9782143.zip | |
Removed JwtOptions
Diffstat (limited to 'src/Web')
| -rw-r--r-- | src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs | 14 | ||||
| -rw-r--r-- | src/Web/DevHive.Web/appsettings.json | 3 |
2 files changed, 4 insertions, 13 deletions
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": "", |
