asp.net mvc - Mvc using Jwt Bearer token authentication fails -
i'm working on .net core application. want accomplish controllers need user logged in, authentication done jwt bearer token. far tried configuring startup.cs app.usejwtbearerauthentication();
this:
app.usejwtbearerauthentication(new jwtbeareroptions { authenticationscheme = jwtbearerdefaults.authenticationscheme, automaticauthenticate = true, automaticchallenge = true, requirehttpsmetadata = false, tokenvalidationparameters = new tokenvalidationparameters { validateaudience = true, validaudience = "http://localhost:5122", validateissuer = true, validissuer = "http://localhost:5122", validateissuersigningkey = false, validatelifetime = true, clockskew = timespan.zero } });
futher decorated controller [authorize]
attribute make sure user logged in. when run without iis managed catch following 'error':
info: microsoft.aspnetcore.authorization.defaultauthorizationservice[2] authorization failed user: (null).
though have no suggestion why user null because in httpcontext it's filled current users' claims. provide me intel on problem lies or how solve it? can post specific code if nessecairy.
thanks in advance!
Comments
Post a Comment