Skip to content

The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch #22046

Closed
@caiocollete

Description

@caiocollete

I'm developing a project using a Domain Tenant Resolver, I can do login in default tenant with admin master, but when I try to log in with the tenant, I receive an error message:

AuthenticationException: The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch
System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions)

HttpRequestException: The SSL connection could not be established, see inner exception.
System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, bool async, Stream stream, CancellationToken cancellationToken)

AuthServer/appsetings.json:

  "App": {
    "SelfUrl": "https://localhost:44355",
    "CorsOrigins": "https://*.Beta01.com,http://localhost:4200,https://localhost:44359,https://localhost:44389,https://localhost:44325",
    "RedirectAllowedUrls": "http://localhost:4200,https://localhost:44363,https://localhost:44359,https://localhost:44360,https://localhost:44389",
    "DisablePII": false
  },
  "ConnectionStrings": {
    "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=Beta01-Personal;Trusted_Connection=True;TrustServerCertificate=true"
  },
  "AuthServer": {
    "Authority": "https://localhost:44355",
    "RequireHttpsMetadata": true,
    "CertificatePassPhrase": "6132db5f-9ddf-42b3-965d-b4d189f754dc"
  },
  "StringEncryption": {
    "DefaultPassPhrase": "mhvLo8IhGumjXM6Z"
  },
  "Redis": {
    "Configuration": "127.0.0.1"
  },
  "TenantResolver": {
    "Domain": "{0}.localhost:44355",
    "Web": "https://{0}.localhost:44316/",
    "Blazor": "https://{0}.localhost:44360/",
    "Validation": {
      "AuthServer": "https://localhost:44355/",
      "AuthServerWildcard": "https://{0}.localhost:44355/"
    }
  }
}

Blazor/appsetings.json:

  "App": {
    "SelfUrl": "https://localhost:44360",
    "DisablePII": false
  },
  "RemoteServices": {
    "Default": {
      "BaseUrl": "https://localhost:44325/"
    },
    "AbpAccountPublic": {
      "BaseUrl": "https://localhost:44355/"
    }
  },
  "Redis": {
    "Configuration": "127.0.0.1"
  },
  "RabbitMQ": {
    "Connections": {
      "Default": {
        "HostName": "localhost"
      }
    },
    "EventBus": {
      "ClientName": "BlazorServer",
      "ExchangeName": "Beta01"
    }
  },
  "AuthServer": {
    "Authority": "https://localhost:44355",
    "RequireHttpsMetadata": true,
    "ClientId": "Beta01_BlazorServer",
    "ClientSecret": "1q2w3e*"
  },
  "StringEncryption": {
    "DefaultPassPhrase": "mhvLo8IhGumjXM6Z"
  },
  "TenantResolver": {
    "Domain": "{0}.localhost:44360",
    "Validation": {
      "AuthServer": "https://localhost:44355/",
      "AuthServerWildcard": "https://{0}.localhost:44355/"
    },
    "UrlToReplace": "localhost"
  }
}

DbMigrator/appsettings.json:

  "ConnectionStrings": {
    "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=Beta01-Personal;Trusted_Connection=True;TrustServerCertificate=true"
  },
  "Redis": {
    "Configuration": "127.0.0.1"
  },
  "OpenIddict": {
    "Applications": {
      "Beta01_Web_Public": {
        "ClientId": "Beta01_Web_Public",
        "ClientSecret": "1q2w3e*",
        "RootUrl": "https://localhost:44316"
      },
      "Beta01_App": {
        "ClientId": "Beta01_App"      },
      "Beta01_BlazorServer": {
        "ClientId": "Beta01_BlazorServer",
        "ClientSecret": "1q2w3e*",
        "RootUrl": "https://localhost:44360"
      },
      "Beta01_Swagger": {
        "ClientId": "Beta01_Swagger",
        "RootUrl": "https://localhost:44325/"
      }
    }
  }
}

HttpApi.Host/appsettings.json

  "App": {
    "SelfUrl": "https://localhost:44325",
    "MVCPublicUrl": "https://localhost:44316",
    "CorsOrigins": "https://*.Beta01.com",
    "DisablePII": false,
    "HealthCheckUrl": "/health-status"
  },
  "ConnectionStrings": {
    "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=Beta01-Personal;Trusted_Connection=True;TrustServerCertificate=true"
  },
  "Redis": {
    "Configuration": "127.0.0.1"
  },
  "RabbitMQ": {
    "Connections": {
      "Default": {
        "HostName": "localhost"
      }
    },
    "EventBus": {
      "ClientName": "HttpApiHost",
      "ExchangeName": "Beta01"
    }
  },
  "AuthServer": {
    "Authority": "https://localhost:44355",
    "RequireHttpsMetadata": true,
    "MetaAddress": "https://localhost:44355",
    "SwaggerClientId": "Beta01_Swagger"
  },
  "StringEncryption": {
    "DefaultPassPhrase": "mhvLo8IhGumjXM6Z"
  },
  "TenantResolver": {
    "Domain": "{0}.localhost:44325",
    "Validation": {
      "AuthServer": "https://localhost:44355/",
      "AuthServerWildcard": "https://{0}.localhost:44355/"
    }
  }
}

WebPublic/appsettings.json:

  "App": {
    "SelfUrl": "https://localhost:44316",
    "DisablePII": false
  },
  "Redis": {
    "Configuration": "127.0.0.1"
  },
  "RemoteServices": {
    "Default": {
      "BaseUrl": "https://localhost:44325/"
    },
    "AbpAccountPublic": {
      "BaseUrl": "https://localhost:44355/"
    }
  },
  "AuthServer": {
    "Authority": "https://localhost:44355",
    "RequireHttpsMetadata": true,
    "ClientId": "Beta01_Web_Public",
    "ClientSecret": "1q2w3e*"
  },
  "TenantResolver": {
    "Domain": "{0}.localhost:44316",
    "Validation": {
      "AuthServer": "https://localhost:44355/",
      "AuthServerWildcard": "https://{0}.localhost:44355/"
    },
    "UrlToReplace": "localhost"
  }
}

Can someone help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions