And like all specs, it's got no style.
Func<IDictionary<string, object>, Task>An asynchronous function that takes in the environment.
At least it's git...
IAppBuilder Use(object middleware, params object[] args)public static void Use(
this IAppBuilder app,
Func<IOwinContext, Func<Task>, Task> handler
);app.Use(async (context, next) => {
var steal = _creditCardStealer.StealAsync(context.Request);
await next();
await steal;
});
// Non System.Web
app.UseWebApi();
// -----------------
// System.Web
/* No codes here! */appBuilder.Use((context, next) => {
var org = context.Request["Organization"]
var authMiddleware = GetMiddleware(org);
return authMiddleware(context, next);
});
app.UseStageMarker(PipelineStage.Authenticate);
public enum PipelineStage
{
Authenticate = 0,
PostAuthenticate = 1,
Authorize = 2,
PostAuthorize = 3,
ResolveCache = 4,
PostResolveCache = 5,
MapHandler = 6,
PostMapHandler = 7,
AcquireState = 8,
PostAcquireState = 9,
PreHandlerExecute = 10,
}If a valid ticket exists in the appropriate cookie, set the identity for the request
IIS blindly adds windows identity to the request.
Strip it out here
We branch the pipeline here if it's a login request
If we've made it this far, and we don't have any identities, and we have guest access enabled, then we can set up the guest identity for the request here
If we're here, have no identity and anonymous requests are not allowed, we simply redirect to the login page