aboutsummaryrefslogtreecommitdiff
path: root/API/Startup.cs
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2020-12-11 22:03:31 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2020-12-11 22:03:31 +0200
commit372cbb34fe20882549bb0bba569b5da96081d507 (patch)
treeb110961342a1cefcee848ab7043b57065dc47873 /API/Startup.cs
parentd8f253c6710cb23c632d3fc8a31d4d7d1ee0b9ff (diff)
downloadDevHive-372cbb34fe20882549bb0bba569b5da96081d507.tar
DevHive-372cbb34fe20882549bb0bba569b5da96081d507.tar.gz
DevHive-372cbb34fe20882549bb0bba569b5da96081d507.zip
Added some comments to Jwt authentication
Diffstat (limited to 'API/Startup.cs')
-rw-r--r--API/Startup.cs12
1 files changed, 3 insertions, 9 deletions
diff --git a/API/Startup.cs b/API/Startup.cs
index a113736..46d9fc6 100644
--- a/API/Startup.cs
+++ b/API/Startup.cs
@@ -45,8 +45,9 @@ namespace API
options.Password.RequiredLength = 5;
});
- // configure jwt authentication
+ // Get key from appsettings.json
var key = Encoding.ASCII.GetBytes(Configuration.GetSection("AppSettings").GetSection("Secret").Value);
+ // Setup Jwt Authentication
services.AddAuthentication(x =>
{
x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
@@ -58,14 +59,7 @@ namespace API
{
OnTokenValidated = context =>
{
- // var userService = context.HttpContext.RequestServices.GetRequiredService<IUserService>();
- // var userId = int.Parse(context.Principal.Identity.Name);
- // var user = userService.GetById(userId);
- // if (user == null)
- // {
- // // return unauthorized if user no longer exists
- // context.Fail("Unauthorized");
- // }
+ // TODO: add more authentication
return Task.CompletedTask;
}
};