public BaseController() { _sendGmail = new SendGmail(); _fileSettingsServiceService = new FileSettingsServiceService(); _appAppSettings = _fileSettingsServiceService.GetSettings(); _customerSettingsService = new CustomerSettingsService(); _headersParser = new HeadersParser(); _headers = _headersParser.ParseHeadersFromFile( System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/RequestHeaders.txt")); _restService = new RestService(new HttpClientServiceFactory()); //This is now fetched via cookies parsing //_restService.SetAuthorizationHeader("Bearer", _appAppSettings.Bearer); #region get Bearer token from Cookies var cookies = _headers.SingleOrDefault(x => x.Key.ToUpper() == "COOKIE").Value.Split(';'); var bearerAuthString = cookies.First(x => x.Contains("aveapps=")).Substring(10); _restService.SetAuthorizationHeader("Bearer", bearerAuthString); #endregion #region check for expired authorization var getUser = _restService.Get <User>("https://api.waveapps.com/user/"); if (!getUser.IsSuccessStatusCode) { throw new InvalidCredentialException(); } #endregion }
public PlaybackFileSettings(IFileSettingsService fileSettingsService, string targetAlias, KStudioClipSource clipSource) { if (String.IsNullOrWhiteSpace(targetAlias)) { throw new ArgumentNullException("targetAlias"); } this.Initialize(fileSettingsService, targetAlias, clipSource); }
protected XElement GetSettings(string settingsKey) { XElement element = null; IFileSettingsService fileSettingsService = ToolsUIApplication.Instance.RootServiceProvider.GetService(typeof(IFileSettingsService)) as IFileSettingsService; if (fileSettingsService != null) { if (this.targetAlias == null) { element = fileSettingsService.GetSettings(this.clipSource, settingsKey); } else { element = fileSettingsService.GetSettings(targetAlias, this.clipSource, settingsKey); } } return(element); }
private void Initialize(IFileSettingsService fileSettingsService, string targetAlias, KStudioClipSource clipSource) { if (clipSource == null) { throw new ArgumentNullException("clipSource"); } this.fileSettingsService = fileSettingsService; this.targetAlias = targetAlias; this.clipSource = clipSource; if (this.fileSettingsService != null) { if (targetAlias == null) { this.fileSettingsService.LoadSettings(this.clipSource); } else { this.fileSettingsService.LoadSettings(this.targetAlias, this.clipSource); } } }
public PlaybackFileSettings(IFileSettingsService fileSettingsService, KStudioClipSource clipSource) { this.Initialize(fileSettingsService, null, clipSource); }
public KslAdReply() { _settingsService = new FileSettingsService(); }