Hi,
Thanks.
In OnPostAsync method the request.UserName is null
How can I get the username trying to logIn?
Yes, but this is not a static class. How can I run this method inside my CustomLoginModel class
Thaks
Hi,
Wich namespace I need to call OpenIddictRequestHelper?
Thanks
After I follow this steps, https://support.abp.io/QA/Questions/4691/Clientid-permissions, can't solve my issue
To override the class OpenIddictSupportedLoginModel, but it dosen't work. The methos OnPostAsync inside that never runs.
I try to override the class LoginModel in AuthServer project, but in the method OnPostAsync the CurrentUser is null.
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(LoginModel))]
public class CustomLoginModel : LoginModel
{
public CustomLoginModel(IAuthenticationSchemeProvider schemeProvider, IOptions<AbpAccountOptions> accountOptions, IAbpRecaptchaValidatorFactory recaptchaValidatorFactory, IAccountExternalProviderAppService accountExternalProviderAppService, ICurrentPrincipalAccessor currentPrincipalAccessor, IOptions<IdentityOptions> identityOptions, IOptionsSnapshot<reCAPTCHAOptions> reCaptchaOptions) : base(schemeProvider, accountOptions, recaptchaValidatorFactory, accountExternalProviderAppService, currentPrincipalAccessor, identityOptions, reCaptchaOptions)
{
}
public override async Task<IActionResult> OnPostAsync(string action)
{
var clientIdClaim = CurrentUser.GetAllClaims().FirstOrDefault(x => x.Type == AbpClaimTypes.ClientId);
if (clientIdClaim != null)
{
if (clientIdClaim.Value == "Internal")
{
if (CurrentUser.IsInRole(Roles.RoleConsts.Internal))
return await base.OnPostAsync(action);
else
throw new AbpAuthorizationException();
}
if (clientIdClaim.Value == "Public")
{
return await base.OnPostAsync(action);
}
}
return await base.OnPostAsync(action);
}
}
What I can do, to get ClientId and Roles from user to try to login?
Thanks
Hi,
With your last recomendation I get this error.
ArgumentOutOfRangeException: The relative expiration value must be positive. (Parameter 'AbsoluteExpirationRelativeToNow')
Actual value was 00:00:00.
Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions.set_AbsoluteExpirationRelativeToNow(Nullable<TimeSpan> value)
Stack Query Cookies Headers Routing
ArgumentOutOfRangeException: The relative expiration value must be positive. (Parameter 'AbsoluteExpirationRelativeToNow') Actual value was 00:00:00.
Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions.set_AbsoluteExpirationRelativeToNow(Nullable<TimeSpan> value)
Cincaporc.WebApp.Web.MyMvcCachedApplicationConfigurationClient+<>c.<GetAsync>b__13_1() in MyMvcCachedApplicationConfigurationClient.cs
() => new DistributedCacheEntryOptions
Volo.Abp.Caching.DistributedCache<TCacheItem, TCacheKey>.GetOrAddAsync(TCacheKey key, Func<Task<TCacheItem>> factory, Func<DistributedCacheEntryOptions> optionsFactory, Nullable<bool> hideErrors, bool considerUow, CancellationToken token)
Cincaporc.WebApp.Web.MyMvcCachedApplicationConfigurationClient.GetAsync() in MyMvcCachedApplicationConfigurationClient.cs
configuration = await Cache.GetOrAddAsync(
Volo.Abp.AspNetCore.Mvc.Client.RemoteLanguageProvider.GetLanguagesAsync()
Microsoft.AspNetCore.RequestLocalization.DefaultAbpRequestLocalizationOptionsProvider.GetLocalizationOptionsAsync()
Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext()
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Hi,
What namespace do I need, to use AbpAspNetCoreMvcClientCacheOptions?
Hi,
Sorry, but not working. I just sent you new logs
Sorry but I don't undestand.
Can you give me an example?
Thanks
Sorry but I can't see where.
In AuthServer project there are only two folders, Themes and pages. And pages only has Index without any Post method
And Where can I override this method, in AuthServer project?