ASP.NET Web API与Owin OAuth:调用与用户相关的Web API(非第三方登录)

授权完成添加属性

      ClaimsIdentity oAuthIdentity = await CreateAsync(user/*userManager*/, OAuthDefaults.AuthenticationType, result);
//oAuthIdentity.AddClaim(new Claim("proid", names[0]));
//ClaimsIdentity cookiesIdentity = await user.GenerateUserIdentityAsync(userManager,
// CookieAuthenticationDefaults.AuthenticationType); AuthenticationProperties properties = CreateProperties(user.Id);
AuthenticationTicket ticket = new AuthenticationTicket(oAuthIdentity, properties);
context.Validated(ticket);
     /// <summary>
/// 创建属性
/// </summary>
/// <param name="userid"></param>
/// <returns></returns>
public static AuthenticationProperties CreateProperties(string userid)
{
IDictionary<string, string> data = new Dictionary<string, string>
{
{ "userid", userid },
{"version","2.2"}
};
return new AuthenticationProperties(data);
}

返回的:ASP.NET Web API与Owin OAuth:调用与用户相关的Web API(非第三方登录)

未完成先占位

上一篇:NetXray


下一篇:MySQL数据迁移到MSSQL-以小米数据库为例-测试828W最快可达到2分11秒