Hi,
Yes, I think that's enough.
Can I check it remotely? my email is shiwei.liang@volosoft.com
Hi,
Your ticket was refunded.
PR has not been merged.
hi
Please set log level to Debug and re-share the logs.txt
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.MinimumLevel.Override("OpenIddict", LogEventLevel.Verbose)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
.WriteTo.Async(c => c.Console())
Thanks.
https://abp.io/support/questions/8650/Limit-the-access-to-Application-in-MVC
It seems to be the same issue, you can override the TokenController.Password
.
public class MyTokenController : TokenController
{
[UnitOfWork]
protected override async Task<IActionResult> HandlePasswordAsync(OpenIddictRequest request)
{
var clientId = request.ClientId;
var client = // get client from repository
// check IP
Logger.LogInformation("IP not allowed", request.Username);
errorDescription = "IP not allowed!";
}
var properties = new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = errorDescription
});
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
}
}
[ExposeServices(typeof(LoginModel))]
[Dependency(ReplaceServices = true)]
public class MyCustomLoginModel : OpenIddictSupportedLoginModel
{
public MyCustomLoginModel(IAuthenticationSchemeProvider schemeProvider, IOptions<AbpAccountOptions> accountOptions, IAbpRecaptchaValidatorFactory recaptchaValidatorFactory, IAccountExternalProviderAppService accountExternalProviderAppService, ICurrentPrincipalAccessor currentPrincipalAccessor, IOptions<IdentityOptions> identityOptions, IOptionsSnapshot<reCAPTCHAOptions> reCaptchaOptions, AbpOpenIddictRequestHelper openIddictRequestHelper) : base(schemeProvider, accountOptions, recaptchaValidatorFactory, accountExternalProviderAppService, currentPrincipalAccessor, identityOptions, reCaptchaOptions, openIddictRequestHelper)
{
}
public override async Task<IActionResult> OnGetAsync()
{
var openIddictRequest = await OpenIddictRequestHelper.GetFromReturnUrlAsync(base.ReturnUrl);
var clientId = openIddictRequest.ClientId;
var client = // get client from repository
// check IP
Logger.LogInformation("IP not allowed", request.Username);
errorDescription = "IP not allowed!";
Alerts.Danger(L["IPNotAllowed"]);
return Page();
}
}
Hi,
Yes, you can override TokenController.Password
(password flow) and login model(code flow)
Can you share your solution structure screenshot
Hi,
We have no such example, you can consider using selenium
for UI test
https://github.com/SeleniumHQ/selenium
https://www.selenium.dev/
https://www.browserstack.com/guide/selenium-with-c-sharp-for-automated-test
What is the best approach to upgrade: should we create a new template with the latest version and manually migrate the code?
Yes, this is the best way, because the version migration is huge, I suggest you create a new project and copy the code
Hi @leeneshk
Is this issue still present?