Ответ 1
Как это часто бывает, я нашел ответ сразу после отправки вопроса...
ApplicationOAuthProvider.cs содержит следующий код из коробки
public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
{
using (UserManager<IdentityUser> userManager = _userManagerFactory())
{
IdentityUser 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 userManager.CreateIdentityAsync(user,
context.Options.AuthenticationType);
ClaimsIdentity cookiesIdentity = await userManager.CreateIdentityAsync(user,
CookieAuthenticationDefaults.AuthenticationType);
AuthenticationProperties properties = CreateProperties(context.UserName, data["udid"]);
AuthenticationTicket ticket = new AuthenticationTicket(oAuthIdentity, properties);
context.Validated(ticket);
context.Request.Context.Authentication.SignIn(cookiesIdentity);
}
}
Просто добавив
var data = await context.Request.ReadFormAsync();
внутри метода вы можете получить доступ ко всем опубликованным переменным в теле запроса и использовать их по своему усмотрению. В моем случае я поместил его сразу после проверки нулевого пользователя, чтобы выполнить более строгую проверку безопасности.
Надеюсь, это поможет кому-то!