private Guid GetCompanyId() { var identity = principalService.GetPrincipal().Identity; if (identity.IsAuthenticated) { return(cacheProvider.Get(identity.Name, GetCompanyId)); } //404 //throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Unauthorized)); throw new Exception(); }
private User GetCurrentUser() { var identity = principalService.GetPrincipal().Identity; if (identity.IsAuthenticated) { var user = cacheProvider.Get(identity.Name, GetUserByEmail); //this return 404 //if (user == null) // throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Unauthorized)); return(user); } //this return 404 //throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Unauthorized)); return(null); }