Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal class WsFederationAuthCleanupMiddleware
- {
- private readonly RequestDelegate _next;
- public WsFederationAuthCleanupMiddleware(RequestDelegate next)
- {
- _next = next ?? throw new ArgumentNullException(nameof(next));
- }
- public Task Invoke(HttpContext context, IAuthorizationService authorizationService)
- {
- var request = context.Request;
- // could look for a specific path as well...
- if (request.Query.TryGetValue("wa", out var wa) && wa == "wsignoutcleanup1.0")
- {
- // Your signin scheme probably cookies
- request.HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
- return Task.CompletedTask;
- }
- return _next(context);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment