abp icon indicating copy to clipboard operation
abp copied to clipboard

IDX10204: Unable to validate issuer. validationParameters.ValidIssuer is null or whitespace AND validationParameters.ValidIssuers is null or empty.

Open wangyue20075 opened this issue 2 years ago • 3 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Description

abp version is 8.1.4. when i user localhost to access ,it's success. but when i use the IP to access, it doesn't work properly. failed to validate the token. IDX10204: Unable to validate issuer. validationParameters.ValidIssuer is null or whitespace AND validationParameters.ValidIssuers is null or empty.

2024-06-13_193101 2024-06-13_193335

Version

8.1.4

User Interface

Common (Default)

wangyue20075 avatar Jun 13 '24 11:06 wangyue20075

See https://github.com/abpframework/abp/issues/15379#issuecomment-1377129014

maliming avatar Jun 13 '24 12:06 maliming

It's success.

context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => {

    options.Authority = configuration["AuthServer:Authority"];
    options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata");
    options.MetadataAddress = configuration["AuthServer:Authority"]!;
    options.Audience = "Admin";

    // IDX10204: Unable to validate issuer on K8s if not set
    options.TokenValidationParameters = new TokenValidationParameters()
    {
        ValidIssuers = new[] { "https://192.168.1.61:44325/" },
        // IDX10500: Signature validation failed. No security keys were provided to validate the signature on K8s
        SignatureValidator = delegate (string token, TokenValidationParameters parameters)
        {
            var jwt = new Microsoft.IdentityModel.JsonWebTokens.JsonWebToken(token);
            return jwt;
        }
    };
});

wangyue20075 avatar Jun 13 '24 13:06 wangyue20075

SignatureValidator = delegate (string token, TokenValidationParameters parameters) { var jwt = new Microsoft.IdentityModel.JsonWebTokens.JsonWebToken(token); return jwt; }

wangyue20075 avatar Jun 13 '24 13:06 wangyue20075