Is it possible to bypass the "Pick user popup" after Sign out with Azure/Entra ID? We need to execute an automatic sign out when the user is not active. The application is a Blazor WASM application.
Here is my Program.cs code:
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using THDVirtualAgent;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddMsalAuthentication(options =>
{
builder.Configuration.Bind("AzureAd", options.ProviderOptions.Authentication);
// Redirect to home page after login failure
options.AuthenticationPaths.LogInFailedPath = "/?loginFailed=true";
// Redirect to home page after logout
options.AuthenticationPaths.LogOutSucceededPath = "/";
});
var assemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
await builder.Build().RunAsync();
Here is the code I am currently using to log the user out:
/// <summary>
/// Handles user inactivity.
/// This method is invoked from JavaScript when the user has been inactive for a certain period of time.
/// It sets the sign out state and navigates to the logout page.
/// </summary>
/// <returns>A completed Task.</returns>
[JSInvokable]
public Task HandleInactivityAsync()
{
//Set the sign out state using the SignOutSessionStateManager
SignOutManager.SetSignOutState();
// Currently not used, but could be used to extract the login hint from the user's claims
var loginHint = ExtractLoginHintFromClaims();
//Navigate to the logout page
NavigationManager.NavigateTo($"authentication/logout");
return Task.CompletedTask;
}