aboutsummaryrefslogtreecommitdiff
path: root/src/Web/DevHive.Web/Configurations/Extensions
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-02-27 11:18:09 +0200
committertranstrike <transtrike@gmail.com>2021-02-27 11:18:09 +0200
commit83ae76a1b93c91cf7cfb5fc9ea1ef728ee47c839 (patch)
tree78711c29342fc3d5b5e643403a507c9b030afa4d /src/Web/DevHive.Web/Configurations/Extensions
parent784b5fc621f71fa94eddf276b0b932ba7d1aa873 (diff)
downloadDevHive-83ae76a1b93c91cf7cfb5fc9ea1ef728ee47c839.tar
DevHive-83ae76a1b93c91cf7cfb5fc9ea1ef728ee47c839.tar.gz
DevHive-83ae76a1b93c91cf7cfb5fc9ea1ef728ee47c839.zip
JWT Validations works; Introduced more bugs to fix later
Diffstat (limited to 'src/Web/DevHive.Web/Configurations/Extensions')
-rw-r--r--src/Web/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Web/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs b/src/Web/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs
index c547951..660a416 100644
--- a/src/Web/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs
+++ b/src/Web/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs
@@ -1,3 +1,6 @@
+using System.Text;
+using DevHive.Common.Jwt;
+using DevHive.Common.Jwt.Interfaces;
using DevHive.Data.Interfaces;
using DevHive.Data.Repositories;
using DevHive.Services.Interfaces;
@@ -27,12 +30,19 @@ namespace DevHive.Web.Configurations.Extensions
services.AddTransient<IPostService, PostService>();
services.AddTransient<ICommentService, CommentService>();
services.AddTransient<IFeedService, FeedService>();
+ services.AddTransient<IRateService, RateService>();
+
services.AddTransient<ICloudService, CloudinaryService>(options =>
new CloudinaryService(
cloudName: configuration.GetSection("Cloud").GetSection("cloudName").Value,
apiKey: configuration.GetSection("Cloud").GetSection("apiKey").Value,
apiSecret: configuration.GetSection("Cloud").GetSection("apiSecret").Value));
- services.AddTransient<IRateService, RateService>();
+
+ services.AddSingleton<IJwtService, JwtService>(options =>
+ new JwtService(
+ signingKey: Encoding.ASCII.GetBytes(configuration.GetSection("Jwt").GetSection("signingKey").Value),
+ validationIssuer: configuration.GetSection("Jwt").GetSection("validationIssuer").Value,
+ audience: configuration.GetSection("Jwt").GetSection("audience").Value));
}
}
}