public IActionResult Index() { var accessToken = _accessTokensRepository.Find(_service.GetType().Name); ViewData["Token"] = accessToken; ViewData["Title"] = _service.GetType().Name; return(View("~/Views/Oauth/Index.cshtml")); }
public User GetAuthenticatedUser(string token) { if (token == null) { throw new ArgumentNullException(nameof(token)); } var accessToken = _accessTokenRepository.Find(token); if (accessToken == null) { return(null); } if (IsExpired(accessToken.ValidUntilValue)) { return(null); } return(_usersRepository.GetById(accessToken.UserId)); }