private string GetClaimsForUser(HttpActionContext actionContext) { var repository = (IRepository <User>)actionContext.Request.GetDependencyScope().GetService(typeof(IRepository <User>)); var loggedInUser = new ExtractLoggedInUser(actionContext.Request.GetOwinContext().Authentication.User, repository) .Do(); return(loggedInUser.NotAny() || loggedInUser.Single().Claims.IsNullOrWhiteSpace() ? "" : loggedInUser.Single().Claims); }
public override void OnActionExecuting(HttpActionContext actionContext) { var repository = (IRepository <User>)actionContext.Request.GetDependencyScope().GetService(typeof(IRepository <User>)); var loggedInUser = new ExtractLoggedInUser(actionContext.Request.GetOwinContext().Authentication.User, repository).Do(); if (loggedInUser.Any()) { var currentUser = (ICurrentUser)actionContext.Request.GetDependencyScope().GetService(typeof(ICurrentUser)); currentUser.Id = loggedInUser.Single().Id; } }