You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All manager classes should receive IHttpContextAccessor that could be used as follows:
publicstaticclassUserService{publicstaticGuidGetCurrentUserId(IHttpContextAccessoraccessor){Claimclaim=accessor.HttpContext.User.Claims.FirstOrDefault(c =>c.Type=="id");if(claim==null){stringmsg="Authorization server does not contains \"id\" property in UserInfo, ensure that you properly configured your UserProperty Mapper";thrownewInvalidOperationException(msg);}returnGuid.Parse(claim.Value);}}