aboutsummaryrefslogtreecommitdiff
path: root/src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-03-13 15:07:51 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-03-13 15:07:51 +0200
commit75d57f305f2ed1ecf8b82bd62d4bb8f17c06303b (patch)
treeb721fe307d22a7a89f8ee13b3e557df4a2e2bbab /src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs
parent503a23c04355624b133161c9356b139f2e4500f6 (diff)
parent4add0831649f6e534d3883aa0e0e7f380d8042c7 (diff)
downloadDevHive-75d57f305f2ed1ecf8b82bd62d4bb8f17c06303b.tar
DevHive-75d57f305f2ed1ecf8b82bd62d4bb8f17c06303b.tar.gz
DevHive-75d57f305f2ed1ecf8b82bd62d4bb8f17c06303b.zip
Merge branch 'dev' of github.com:Team-Kaleidoscope/DevHive into unit_test_refactoring
Diffstat (limited to 'src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs')
-rw-r--r--src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs14
1 files changed, 4 insertions, 10 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
};