Microsoft.Legal.MatterCenter.Jobs.KeyVaultHelper.GetCert C# (CSharp) Method

GetCert() public static method

public static GetCert ( IConfiguration configurtaion ) : void
configurtaion IConfiguration
return void
        public static void GetCert(IConfiguration configurtaion)
        {
            var clientAssertionCertPfx = CertificateHelper.FindCertificateByThumbprint(configurtaion["General:KeyVaultCertThumbPrint"].ToString());
            AssertionCert = new ClientAssertionCertificate(configurtaion["General:KeyVaultClientID"], clientAssertionCertPfx);
        }

Usage Example

Example #1
0
 /// <summary>
 /// This method will read external access requests azure table storage for all
 /// pending requests and update the matter related lists and libraries permissions for external users
 /// </summary>
 /// <param name="timerInfo"></param>
 /// <param name="matterInformationVM"></param>
 /// <param name="log"></param>
 public static void ReadExternalAccessRequests([TimerTrigger("00:00:05", RunOnStartup = true)] TimerInfo timerInfo,
                                               [Table("ExternalAccessRequests")] IQueryable <MatterInformationVM> matterInformationVM,
                                               TextWriter log)
 {
     try
     {
         var builder = new ConfigurationBuilder()
                       .SetBasePath(Directory.GetCurrentDirectory())
                       .AddJsonFile("appSettings.json")
                       .AddEnvironmentVariables();//appsettings.json will be overridden with azure web appsettings
         var            configuration = builder.Build();
         KeyVaultHelper kv            = new KeyVaultHelper(configuration);
         KeyVaultHelper.GetCert(configuration);
         kv.GetKeyVaultSecretsCerticate();
         //Read all rows from table storage which
         //Read all rows from table storage which are in pending state
         var query = from p in matterInformationVM select p;
         foreach (MatterInformationVM matterInformation in query)
         {
             if (matterInformation != null)
             {
                 if (matterInformation.Status.ToLower() == "pending")
                 {
                     string serializedMatter = matterInformation.SerializeMatter;
                     //De Serialize the matter information
                     MatterInformationVM originalMatter = Newtonsoft.Json.JsonConvert.DeserializeObject <MatterInformationVM>(serializedMatter);
                     log.WriteLine($"Checking the matter name {originalMatter.Matter.Name} has been acceped by the user or not");
                     //Read all external access requests records from azure table storge
                     GetExternalAccessRequestsFromSPO(originalMatter, log, configuration);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         log.WriteLine($"Exception occured in the method ReadExternalAccessRequests. {ex}");
     }
 }
All Usage Examples Of Microsoft.Legal.MatterCenter.Jobs.KeyVaultHelper::GetCert