62,263
社区成员
发帖
与我相关
我的任务
分享
//passWord方式授权
public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
{
var oAuthIdentity = new ClaimsIdentity(context.Options.AuthenticationType);
//Custom code for Match user
if (!UserService.Login(context.UserName, context.Password)) //判断用户名、密码是否正确
{
return;
}
oAuthIdentity.AddClaim(new Claim(ClaimTypes.Name, context.UserName));
context.Validated(oAuthIdentity);
}