- ASP.NET 정체성에 대한 업그레이드 할 필요가 없습니다, 당신은 멤버 자격 공급자로 작업 할 수 있습니다
- 당신이 라인을 변경할 필요가 아래 코드를 보면, 사용자 이름과 암호를 검증하기 위해 기존 멤버 자격 공급자를 사용할 수 있습니다 (**) 접두어가 붙은 코드는 사용자의 memebership.validate 메소드와 함께 사용하면됩니다.
당신은 내 세부 Token based Authentication Post
public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
{
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });
using (AuthRepository _repo = new AuthRepository())
{
**IdentityUser user = await _repo.FindUser(context.UserName, context.Password);**
if (user == null)
{
context.SetError("invalid_grant", "The user name or password is incorrect.");
return;
}
}
var identity = new ClaimsIdentity(context.Options.AuthenticationType);
identity.AddClaim(new Claim("sub", context.UserName));
identity.AddClaim(new Claim("role", "user"));
context.Validated(identity);
}
이에 대한 자세한 내용을보실 수 있습니다