Skip to content

Commit

Permalink
Fix code scanning alert - Missing Dispose call on local IDisposable (#…
Browse files Browse the repository at this point in the history
…115)

* fix #102 - Check if device model is present before requesting the current device model (#105)

* Fix code scanning alert - Missing Dispose call on local IDisposable

Co-authored-by: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com>
  • Loading branch information
audserraCGI and kbeaugrand authored Jan 27, 2022
1 parent bf1e890 commit d8ca25a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/AzureIoTHub.Portal/Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,22 @@ public static async Task Main(string[] args)

private static async Task ConfigureOidc(WebAssemblyHostBuilder builder)
{
var httpClient = new HttpClient() { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) };
var settings = await httpClient.GetFromJsonAsync<OIDCSettings>("OIDCSettings");

builder.Services.AddOidcAuthentication(options =>
using (var httpClient = new HttpClient() { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) })
{
options.ProviderOptions.Authority = settings.Authority;
options.ProviderOptions.MetadataUrl = settings.MetadataUrl;
options.ProviderOptions.ClientId = settings.ClientId;
var settings = await httpClient.GetFromJsonAsync<OIDCSettings>("OIDCSettings");

builder.Services.AddOidcAuthentication(options =>
{
options.ProviderOptions.Authority = settings.Authority;
options.ProviderOptions.MetadataUrl = settings.MetadataUrl;
options.ProviderOptions.ClientId = settings.ClientId;

options.ProviderOptions.DefaultScopes.Clear();
options.ProviderOptions.DefaultScopes.Add($"profile openid {settings.Scope}");
options.ProviderOptions.DefaultScopes.Clear();
options.ProviderOptions.DefaultScopes.Add($"profile openid {settings.Scope}");

options.ProviderOptions.ResponseType = "id_token";
});
options.ProviderOptions.ResponseType = "id_token";
});
}
}
}
}

0 comments on commit d8ca25a

Please sign in to comment.