Activities of "liangshiwei"

Hi,

We will eliminate this log for client credentials

Hi,

This is by designed https://github.com/abpframework/abp/pull/20045

Hi

See https://support.apple.com/en-hk/guide/mac-help/mchleab3a043/mac

You have to download the account pro page source code to compare them

Hi,

Could you share a minimal reproducible project with me? i will check it.

My email is shiwei.liang@volosoft.com

Hi,

This is free version source code,

you can download account pro module source code: abp get-source Volo.Abp.Account.Pro

okay, : )

API log gets spammed with: +- 50 times:

2024-10-01 07:40:53Z [DBG] Get dynamic claims cache for user: c7356510-4d74-f816-9a7d-3a0624e8562a

Hi,

This should not be a problem; ABP only calls once in a HTTP request.

And you can try disable dynamic claims system to test it

context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
{
options.IsDynamicClaimsEnabled = false;
});

Hi,

You can try this

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IAbpAccessTokenProvider))]
public class MyAccessTokenProvider : HttpContextAbpAccessTokenProvider
{
    private readonly IHttpClientFactory _httpClientFactory;
    private readonly IConfiguration _configuration;
    
    public MyAccessTokenProvider(IHttpContextAccessor httpContextAccessor, IHttpClientFactory httpClientFactory, IConfiguration configuration) : base(httpContextAccessor)
    {
        _httpClientFactory = httpClientFactory;
        _configuration = configuration;
    }

    public override async Task<string?> GetTokenAsync()
    {
        var authenticationInfo = await HttpContextAccessor.HttpContext.AuthenticateAsync();
        
        var refreshToken = authenticationInfo.Properties?.GetTokenValue("refresh_token");
        var tokenString = authenticationInfo.Properties?.GetTokenValue("access_token");
        
        if (tokenString.IsNullOrWhiteSpace() || refreshToken.IsNullOrWhiteSpace())
        {
            return tokenString;
        }

        var token = new JwtSecurityTokenHandler().ReadJwtToken(tokenString);
        
        // check token expiration and refresh token if needed
        if (token.ValidTo < DateTime.UtcNow.AddMinutes(5))
        {
            var client = _httpClientFactory.CreateClient();
            
            var response = await client.RequestRefreshTokenAsync(new RefreshTokenRequest
            {
                ClientId = _configuration["AuthServer:ClientId"]!,
                ClientSecret = _configuration["AuthServer:ClientSecret"]!,
                RefreshToken = refreshToken,
                Address = _configuration["AuthServer:Authority"]!.EnsureEndsWith('/') + "connect/token"
            });
                       
            
            authenticationInfo.Properties.UpdateTokenValue(
                "access_token", response.AccessToken);
            authenticationInfo.Properties.UpdateTokenValue(
                "refresh_token", response.RefreshToken);

            return response.AccessToken;
        }
        
        return tokenString;
        
    }
}

Hi,

We will fix the problem, your ticket was refunded.

Showing 151 to 160 of 5863 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35