关于Owin 及其内部实现运行逻辑的解析,详见:
http://www.cnblogs.com/hmxb/p/5299216.html
关于Owin Oatuh 授权和验证示例,详见:
https://www.cnblogs.com/xishuai/p/aspnet-webapi-owin-oauth2.html
关于Asp.net ClaimIdentity和ClaimPrincipal ,详见:
http://www.cnblogs.com/jesse2013/p/aspnet-identity-claims-based-authentication-and-owin.html#how-identity-loginin
1. OAuthAuthorizationServerMiddleware
1.1 整个认证服务的故事,是从Startup的方法Configuration(IAppBuilder app)开始的,在此方法中,通过调用app.UseOAuthAuthorizationServer(serverOptions)方法,将OAuthAuthorizaitonServerMiddleware注册到Owin的Pipeline上。
1.2 OAuthAuthorizationServerHandler
一个请求到达Middleware后,其内部实现了一个CreateHandler的方法,OAuthServer中间件对应的Handler就是OAuthAuthorizationServerHandler.