public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { AddCorsHeader(context); AppUser user; using (AppUserRepository appUserRepository = new AppUserRepository()) { if (await appUserRepository.ValidateUser(context.UserName, context.Password) == false) { context.SetError("invalid_grant", "The Username or Password is incorrect."); return; } user = await appUserRepository.FindUserByUsername(context.UserName); //if (!user.IsAuthorized) //{ // context.SetError("invalid_grant", "This user is not an authorized user. Please contact the site owner."); // return; //} await appUserRepository.RecordUserLoggedInSuccessfully(user.Id); } AddClaimsToIdentity(context, user); }