コード例 #1
0
        public override async Task Invoke(IOwinContext context)
        {
            await context.EnsureRequestBodyStreamSeekable().ConfigureAwait(false);

            if (!options.Bypass(context.Request) &&
                !await context.TryAuthenticate(authenticator, options.HideExceptionsAndReturnUnauthorized).ConfigureAwait(false))
            {
                context.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
                return;
            }

            context.Request.Body.Rewind();

            await Next.Invoke(context).ConfigureAwait(false);
        }