public KeyVaultAdminService(IOptionsSnapshot <AzureAdOptions> azureAdOptions,
                                    IOptionsSnapshot <AdminConfig> adminConfig,
                                    IOptionsSnapshot <ResourceIds> resources,
                                    IGraphHttpService graphHttpService,
                                    IApplicationConfiguration applicationConfiguration,
                                    IUser user,
                                    IHttpContextAccessor contextAccessor)
        {
            userId   = user.ObjectId;
            tenantId = Guid.Parse(user.TenantId);
            clientId = Guid.Parse(azureAdOptions.Value.ClientId);

            adalContext   = new AuthenticationContext($"{azureAdOptions.Value.AADInstance}{azureAdOptions.Value.TenantId}", new ADALSessionCache(userId, contextAccessor));
            resourceGroup = adminConfig.Value.ResourceGroup;

            kvManagmentClient = new KeyVaultManagementClient(new AutoRestCredential <KeyVaultManagementClient>(GetAppToken))
            {
                SubscriptionId = adminConfig.Value.SubscriptionId,
                BaseUri        = new Uri(adminConfig.Value.ArmInstance)
            };
            kvClient = new KeyVaultClient(new AutoRestCredential <KeyVaultClient>(GetAppTokenForKv));

            this.azureAdOptions           = azureAdOptions.Value;
            this.adminConfig              = adminConfig.Value;
            this.graphHttpService         = graphHttpService;
            this.applicationConfiguration = applicationConfiguration;
            this.resources = resources.Value;
        }
 public Report(ReportSeverity severity, ResourceIds id, string caption, string details)
 {
     _resourceId = id.ToString();
     _caption = caption;
     _details = details;
     _severity = severity;
 }
 /// <summary>
 /// Create a warning report.
 /// </summary>
 /// <param name="key">A resource ID to be used to retrieve generic help about this report</param>
 /// <param name="caption">A short description, typically less than 100 charactors, shorter the better</param>
 /// <param name="details">Extended details, can be formatted using WikiText syntax.</param>
 /// <returns>A warning report</returns>
 public static IReport Warning(ResourceIds id, string caption, string details)
 {
     return new Report(ReportSeverity.Warning, id, caption, details);
 }
 /// <summary>
 /// Create an error report.
 /// </summary>
 /// <param name="key">A resource ID to be used to retrieve generic help about this report</param>
 /// <param name="caption">A short description, typically less than 100 charactors, shorter the better</param>
 /// <param name="details">Extended details, can be formatted using WikiText syntax.</param>
 /// <returns>An error report</returns>
 public static IReport Error(ResourceIds id, string caption, string details)
 {
     return new Report(ReportSeverity.Error, id, caption, details);
 }