Ich habe Azure Enra externe ID implementiert. Ich kann mich anmelden und mich abmelden. In der Datei programm.cs Wenn ich die Entra -ID konfiguriert habe, verwende ich die Identitätsanmeldung und Abmeldeendpunkte. Ich kann den Code nicht ändern. Ich möchte nur einen Anruf bei der externen API vor dem Logout haben. Hier ist meine Programme.cs -Datei. HHW kann ich einen Vor-Logout-Anruf tätigen?
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.Identity.Web;
using Microsoft.Identity.Web.UI;
using System.IdentityModel.Tokens.Jwt;
var builder = WebApplication.CreateBuilder(args);
JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
builder.Services.AddMicrosoftIdentityWebAppAuthentication(builder.Configuration)
.EnableTokenAcquisitionToCallDownstreamApi(
[
builder.Configuration.GetSection("DownstreamApi:Scopes:Read").Get()!,
builder.Configuration.GetSection("DownstreamApi:Scopes:Write").Get()!
]
)
.AddDownstreamApi("DownstreamApi", builder.Configuration.GetSection("DownstreamApi"))
.AddInMemoryTokenCaches();
builder.Services.AddControllersWithViews(options =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
options.Filters.Add(new AuthorizeFilter(policy));
}).AddMicrosoftIdentityUI();
builder.Services.AddRazorPages();// Add services to the container.
builder.Services.AddControllersWithViews();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();
async Task TestMethodAsync(HttpContext context)
{
// Actual async work here
Console.WriteLine("Performing pre-logout actions");
await Task.Delay(1);
}
// This is what I have tried but it's not working
//builder.Services.ConfigureApplicationCookie(options =>
//{
// options.Events.OnSigningOut = async context =>
// {
// // Call your custom method here
// await TestMethodAsync(context.HttpContext);
// };
//});
Ich habe Azure Enra externe ID implementiert. Ich kann mich anmelden und mich abmelden. In der Datei programm.cs Wenn ich die Entra -ID konfiguriert habe, verwende ich die Identitätsanmeldung und Abmeldeendpunkte. Ich kann den Code nicht ändern. [url=viewtopic.php?t=14917]Ich möchte[/url] nur einen Anruf bei der externen API vor dem Logout haben. Hier ist meine Programme.cs -Datei. HHW kann ich einen Vor-Logout-Anruf tätigen?[code]using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.Identity.Web; using Microsoft.Identity.Web.UI; using System.IdentityModel.Tokens.Jwt;
builder.Services.AddControllersWithViews(options => { var policy = new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() .Build(); options.Filters.Add(new AuthorizeFilter(policy)); }).AddMicrosoftIdentityUI();
builder.Services.AddRazorPages();// Add services to the container.
builder.Services.AddControllersWithViews();
var app = builder.Build();
// Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); }
async Task TestMethodAsync(HttpContext context) { // Actual async work here Console.WriteLine("Performing pre-logout actions"); await Task.Delay(1); }
// This is what I have tried but it's not working //builder.Services.ConfigureApplicationCookie(options => //{ // options.Events.OnSigningOut = async context => // { // // Call your custom method here // await TestMethodAsync(context.HttpContext); // }; //}); [/code]
Ich habe eine native React -App, in der ich Firebase/Auth .
Ich habe in meinem Paket.json Datei:
. dependencies : {
....
@react-native-firebase/analytics : ^21.7.1 ,
@react-native-firebase/app :...
Wie kann ich ein QT -Fenster benachrichtigen, wenn sich sein Sichtbarkeitsstatus geändert hat? />
Ich möchte eine Funktion aufrufen, wenn das Fenster A ändert (ausblenden) zu (anzeigen).
Ich habe ein C# .NET 8-Webapi, wobei Metriken, Verfolgung und Protokollierung über Opentelemetry an Azure Monitor gesendet werden. var serviceName = My-import-service ;
var connStr =...
Ich habe ein C# .NET 8-Webapi, wobei Metriken, Verfolgung und Protokollierung über Opentelemetry an Azure Monitor gesendet werden.var serviceName = My-import-service ;
var connStr =...
Mir ist bewusst, dass Sie ein Objekt in c# mit „lock“ sperren können, aber können Sie die Sperre aufgeben und darauf warten, dass etwas anderes Sie darüber informiert, dass es sich geändert hat, so...