Я только начал работать над веб-api 2 и попытался войти. Я создал простой веб-проект api 2, и я хочу, чтобы сделать аутентификацию на токене с помощью моего собственного пользовательского репозитория. Я хочу получить/обновить/создать/удалить пользователя, используя собственный собственный репозиторий.User Repository With Web api
Мой репозиторий находится в другом проекте, и я хочу использовать его здесь.
public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
{
var userManager = context.OwinContext.GetUserManager<ApplicationUserManager>();
ApplicationUser user = await userManager.FindAsync(context.UserName, context.Password);
if (user == null)
{
context.SetError("invalid_grant", "The user name or password is incorrect.");
return;
}
ClaimsIdentity oAuthIdentity = await user.GenerateUserIdentityAsync(userManager,
OAuthDefaults.AuthenticationType);
ClaimsIdentity cookiesIdentity = await user.GenerateUserIdentityAsync(userManager,
CookieAuthenticationDefaults.AuthenticationType);
AuthenticationProperties properties = CreateProperties(user.UserName);
AuthenticationTicket ticket = new AuthenticationTicket(oAuthIdentity, properties);
context.Validated(ticket);
context.Request.Context.Authentication.SignIn(cookiesIdentity);
}
некоторые, где на данный момент userManager.FindAsync
. Как я могу подключить свой репозиторий к нему
Итак, в чем ваш вопрос? –
Как я могу использовать свой репозиторий. Потому что все, что я вижу, это то, что мне нужен пользователь UserManager/UserStore – Ancient