public async Task <IActionResult> Authenticate(AuthenticateUserRequest request) { RemoteAuthToken authToken = await _repository.GetRemoteAuthTokenAsync(request.Token); if (authToken == null || authToken.ValidUntil < DateTime.Now) { return(NotFound()); } return(Json(new CrossConnectionUser(authToken.User))); }
public async Task <IActionResult> SendCrossLogin(string address, string type) { if (String.IsNullOrEmpty(address)) { return(Redirect("/")); } await _crossConnectionManager.SetupContact(address); RemoteAuthToken token = new RemoteAuthToken() { Token = Guid.NewGuid().ToString(), UserID = Tools.GetUserID(User), ValidUntil = DateTime.Now.AddMonths(1) }; await _repository.AddRemoteAuthTokenAsync(token); await _repository.SaveChangesAsync(); return(Redirect($"{address}/Login/Callback?token={token.Token}&address={_config.InstanceURL}&type={type}")); }