public async Task <object> Get(GetLocalUser request) { var user = await _connectManager.GetLocalUser(request.ConnectUserId).ConfigureAwait(false); if (user == null) { throw new ResourceNotFoundException(); } return(ToOptimizedResult(new ConnectAuthenticationExchangeResult { AccessToken = user.ConnectAccessKey, LocalUserId = user.Id.ToString("N") })); }
public async Task <object> Get(GetLocalUser request) { var user = await _connectManager.GetLocalUser(request.ConnectUserId).ConfigureAwait(false); if (user == null) { throw new ResourceNotFoundException(); } var auth = _authContext.GetAuthorizationInfo(Request); if (string.IsNullOrWhiteSpace(auth.Client)) { return(ToOptimizedResult(new ConnectAuthenticationExchangeResult { AccessToken = user.ConnectAccessKey, LocalUserId = user.Id.ToString("N") })); } var session = await _sessionManager.CreateNewSession(new AuthenticationRequest { App = auth.Client, AppVersion = auth.Version, DeviceId = auth.DeviceId, DeviceName = auth.Device, RemoteEndPoint = Request.RemoteIp, Username = user.Name, UserId = user.Id.ToString("N") }).ConfigureAwait(false); return(ToOptimizedResult(new ConnectAuthenticationExchangeResult { AccessToken = session.AccessToken, LocalUserId = session.User.Id })); }