Example #1
0
 protected async Task<bool> VerifyDomainAccount(Guid domainId, SettingsFactory settingsFactory, Settings settings, IDomainService domainService)
 {
     Domain domain = await GetDomain(
         domainId,
         settingsFactory,
         settings,
         GetAccessToken(),
         domainService
         );
     return VerifyDomainAccount(domain);
 }
Example #2
0
 private async Task<AccountDomain> GetDomain(Guid domainId, SettingsFactory settingsFactory, Settings settings, string accessToken, IDomainService domainService)
 {
     HashAlgorithm hashAlgorithm = SHA256.Create();
     string hash = Convert.ToBase64String(hashAlgorithm.ComputeHash(Encoding.UTF8.GetBytes(accessToken)));
     return await m_cache.Execute<Task<AccountDomain>>(async context =>
     {
         return await domainService.GetAccountDomain(
         settingsFactory.CreateAccount(settings, accessToken),
         domainId
         );
     },
     new Context(string.Format("{0:N}::{1}::{2}", domainId, hash, settings.AccountApiBaseAddress))
     );
 }
Example #3
0
 protected async Task LogException(Exception ex, IExceptionService exceptionService, SettingsFactory settingsFactory, Settings settings)
 {
     try
     {
         Console.WriteLine(ex.ToString());
         if (!string.IsNullOrEmpty(settings.ExceptionLoggingDomainId) && !string.IsNullOrEmpty(settings.LogApiBaseAddress))
             await exceptionService.Create(
                 settingsFactory.CreateLog(settings, GetAccessToken()),
                 Guid.Parse(settings.ExceptionLoggingDomainId),
                 ex
                 );
     }
     catch (Exception innerException)
     {
         Console.Write(innerException.ToString());
     }
 }
Example #4
0
 protected virtual async Task<bool> VerifyDomainAccountWriteAccess(Guid domainId, SettingsFactory settingsFactory, Settings settings, IDomainService domainService)
 {
     AccountDomain domain = await GetDomain(
     domainId,
     settingsFactory,
     settings,
     GetAccessToken(),
     domainService
     );
     return !domain.Account.Locked && VerifyDomainAccount(domain);
 }