@@ -57,8 +57,11 @@ public WsFederationHandler(IOptionsMonitor<WsFederationOptions> options, ILogger
57
57
/// <returns></returns>
58
58
public override Task < bool > HandleRequestAsync ( )
59
59
{
60
- if ( Options . RemoteSignOutPath . HasValue && Options . RemoteSignOutPath == Request . Path )
60
+ if ( Options . RemoteSignOutPath . HasValue && Options . RemoteSignOutPath == Request . Path && HttpMethods . IsGet ( Request . Method )
61
+ && string . Equals ( Request . Query [ WsFederationConstants . WsFederationParameterNames . Wa ] ,
62
+ WsFederationConstants . WsFederationActions . SignOutCleanup , StringComparison . OrdinalIgnoreCase ) )
61
63
{
64
+ // We've received a remote sign-out request
62
65
return HandleRemoteSignOutAsync ( ) ;
63
66
}
64
67
@@ -374,18 +377,12 @@ public async virtual Task SignOutAsync(AuthenticationProperties properties)
374
377
}
375
378
376
379
/// <summary>
377
- /// Handles requests to the RemoteSignOutPath and signs out the user.
380
+ /// Handles wsignoutcleanup1.0 messages sent to the RemoteSignOutPath
378
381
/// </summary>
379
382
/// <returns></returns>
380
383
protected virtual async Task < bool > HandleRemoteSignOutAsync ( )
381
384
{
382
- WsFederationMessage message = null ;
383
-
384
- if ( string . Equals ( Request . Method , "GET" , StringComparison . OrdinalIgnoreCase ) )
385
- {
386
- message = new WsFederationMessage ( Request . Query . Select ( pair => new KeyValuePair < string , string [ ] > ( pair . Key , pair . Value ) ) ) ;
387
- }
388
-
385
+ var message = new WsFederationMessage ( Request . Query . Select ( pair => new KeyValuePair < string , string [ ] > ( pair . Key , pair . Value ) ) ) ;
389
386
var remoteSignOutContext = new RemoteSignOutContext ( Context , Scheme , Options , message ) ;
390
387
await Events . RemoteSignOut ( remoteSignOutContext ) ;
391
388
@@ -403,15 +400,8 @@ protected virtual async Task<bool> HandleRemoteSignOutAsync()
403
400
}
404
401
}
405
402
406
- if ( message == null
407
- || ! string . Equals ( message . Wa , WsFederationConstants . WsFederationActions . SignOutCleanup , StringComparison . OrdinalIgnoreCase ) )
408
- {
409
- return false ;
410
- }
411
-
412
403
Logger . RemoteSignOut ( ) ;
413
404
414
- // We've received a remote sign-out request
415
405
await Context . SignOutAsync ( Options . SignOutScheme ) ;
416
406
return true ;
417
407
}
0 commit comments