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