Owin Stage Markers
<p>Given this in my app startup ...</p>

<pre><code>app.Use((context, next) =&gt;
{
   return next.Invoke();
}).UseStageMarker(PipelineStage.PostAuthenticate);


app.Use((context, next) =&gt;
{
   return next.Invoke();
}).UseStageMarker(PipelineStage.Authenticate);
</code></pre>

<p>... why does the PostAuthenticate code execute before the Authenticate code?</p>

<p>I don't mean "why does the first app.use get called before the second app.use" I mean: Why does the first invoke get called before the second given that that the second should be happening earlier in the request pipeline?</p>

<p><strong>EDIT</strong></p>

<p>Related to this problem: <a href="https://stackoverflow.com/questions/37169759/how-am-i-getting-a-windows-identity-in-this-code">How am I getting a windows identity in this code?</a></p>