public void OnDidLogin(JToken e) { using (Log.CriticalOperation($"{nameof(OnDidLogin)} Method={DidLoginNotificationType.MethodName}", Serilog.Events.LogEventLevel.Debug)) { try { if (e == null) { Log.IsNull(nameof(OnDidLogin)); } else { var componentModel = _serviceProvider.GetService(typeof(SComponentModel)) as IComponentModel; Assumes.Present(componentModel); var authenticationController = new AuthenticationController( _settingsServiceFactory.Create(), componentModel.GetService <ISessionService>(), _eventAggregator, componentModel.GetService <ICredentialsService>(), componentModel.GetService <IWebviewUserSettingsService>() ); authenticationController.CompleteSigninAsync(e["data"]); } } catch (Exception ex) { Log.Error(ex, "Problem with AutoSignIn"); } } }
protected async System.Threading.Tasks.Task OnServerInitializedBaseAsync(JsonRpc rpc, IComponentModel componentModel) { try { Log.Debug($"{nameof(OnServerInitializedBaseAsync)} starting..."); var codeStreamAgentService = componentModel.GetService <ICodeStreamAgentService>(); await codeStreamAgentService.SetRpcAsync(rpc); bool autoSignInResult = false; try { Log.Debug($"TryAutoSignInAsync starting..."); var authenticationController = new AuthenticationController( SettingsServiceFactory.Create(), componentModel.GetService <ISessionService>(), codeStreamAgentService, EventAggregator, componentModel.GetService <ICredentialsService>(), componentModel.GetService <IWebviewUserSettingsService>() ); autoSignInResult = await authenticationController.TryAutoSignInAsync(); } catch (Exception ex) { Log.Error(ex, nameof(OnServerInitializedBaseAsync)); } Log.Information($"AutoSignIn Result={autoSignInResult}"); Log.Debug($"Switching to UI thread"); await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(CancellationToken.None); Log.Debug("Switched to UI thread"); Log.Debug($"Publishing {nameof(LanguageServerReadyEvent)}..."); EventAggregator.Publish(new LanguageServerReadyEvent { IsReady = true }); Log.Debug($"Published {nameof(LanguageServerReadyEvent)}"); } catch (Exception ex) { Log.Fatal(ex, nameof(OnServerInitializedBaseAsync)); throw; } }
private Task <JToken> InitializeAsync() { Log.Debug($"{nameof(InitializeAsync)}"); var settingsManager = _settingsServiceFactory.Create(); var extensionInfo = settingsManager.GetExtensionInfo(); var ideInfo = settingsManager.GetIdeInfo(); return(SendCoreAsync <JToken>("codestream/onInitialized", new LoginRequest { ServerUrl = settingsManager.ServerUrl, Extension = extensionInfo, Ide = ideInfo, Proxy = settingsManager.Proxy, ProxySupport = settingsManager.Proxy?.Url?.IsNullOrWhiteSpace() == false ? "override" : settingsManager.ProxySupport.ToJsonValue(), DisableStrictSSL = settingsManager.DisableStrictSSL, #if DEBUG TraceLevel = TraceLevel.Verbose.ToJsonValue(), IsDebugging = true #else TraceLevel = settingsManager.GetAgentTraceLevel().ToJsonValue() #endif }));
public WebViewRouter( IComponentModel componentModel, IWebviewUserSettingsService webviewUserSettingsService, ISessionService sessionService, ICodeStreamAgentService codeStreamAgent, ISettingsServiceFactory settingsServiceFactory, IEventAggregator eventAggregator, IBrowserService browserService, IIdeService ideService, IEditorService editorService, IAuthenticationServiceFactory authenticationServiceFactory) { _componentModel = componentModel; _webviewUserSettingsService = webviewUserSettingsService; _sessionService = sessionService; _codeStreamAgent = codeStreamAgent; _settingsManager = settingsServiceFactory.Create(); _eventAggregator = eventAggregator; _browserService = browserService; _ideService = ideService; _editorService = editorService; _authenticationServiceFactory = authenticationServiceFactory; }