Open Closed

Local Docker Installation #4754


User avatar
0
Spospisil created
  • ABP Framework version: v7.0.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): Tiered and Identity Server Separated
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

I am still unable to get my solution working in a deployed local docker environment. Here is the log and docker-compose file that I'm using. I get a 400 error after I hit the login button after entering the admin credentials.

[12:19:26 INF] The authorization request was successfully validated. [12:19:26 INF] Executing endpoint 'Volo.Abp.OpenIddict.Controllers.AuthorizeController.HandleAsync (Volo.Abp.OpenIddict.AspNetCore)' [12:19:26 INF] Route matched with {action = "Handle", controller = "Authorize", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] HandleAsync() on controller Volo.Abp.OpenIddict.Controllers.AuthorizeController (Volo.Abp.OpenIddict.AspNetCore). [12:19:26 INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy [12:19:26 INF] Executing SignInResult with authentication scheme (OpenIddict.Server.AspNetCore) and the following principal: System.Security.Claims.ClaimsPrincipal. [12:19:27 INF] The authorization response was successfully returned to 'https://localhost:44353/signin-oidc' using the form post response mode: { "code": "[redacted]", "id_token": "[redacted]", "state": "CfDJ8JNGHrywwLhJnvwAUL66UAxPdLLBfPpa7emn0WrG6bMsqF6V2Nv9xIt9U0xN9zs7ZqO_13mO26aijrLaz-f0_R3MU-VKISz_Pf8xWkLzNzPvJwEvudhPzbQoIXyFavyCIJK5hbdYBQicpQSOV_oKWdVNo_ITCpkEIahJpg0S51mXmskdbOKihz_FAfjCyzRdfxPqVocSAPKztHaq0a-wqSGKWjEPO-AKtr_XIiij7Tj1xeFrFhl9UcP6mQdXHKg4Xu0ysxgszeb2ZeAMKPV2SOS0DT8K__ikGf8N_JhDdQGP6yiX-aH7vO6QWGMKDNN6Fg", "iss": "https://localhost:44334/" }. [12:19:27 INF] Executed action Volo.Abp.OpenIddict.Controllers.AuthorizeController.HandleAsync (Volo.Abp.OpenIddict.AspNetCore) in 637.4761ms [12:19:27 INF] Executed endpoint 'Volo.Abp.OpenIddict.Controllers.AuthorizeController.HandleAsync (Volo.Abp.OpenIddict.AspNetCore)' [12:19:27 INF] Request finished HTTP/2 GET https://localhost:44334/connect/authorize?client_id=StructureWeb_Web&redirect_uri=https%3A%2F%2Flocalhost%3A44353%2Fsignin-oidc&response_type=code%20id_token&scope=openid%20profile%20roles%20email%20phone%20StructureWeb&response_mode=form_post&nonce=638150843365765353.NmRjZTI4NzUtNmRjZS00YmQxLWFjMTMtZTkzYWE5ZTMxNWM3ZTU5MDk2NjAtMzM5ZC00YThjLTg1MjAtMTJkZDAwMTA2ODA4&state=CfDJ8JNGHrywwLhJnvwAUL66UAxPdLLBfPpa7emn0WrG6bMsqF6V2Nv9xIt9U0xN9zs7ZqO_13mO26aijrLaz-f0_R3MU-VKISz_Pf8xWkLzNzPvJwEvudhPzbQoIXyFavyCIJK5hbdYBQicpQSOV_oKWdVNo_ITCpkEIahJpg0S51mXmskdbOKihz_FAfjCyzRdfxPqVocSAPKztHaq0a-wqSGKWjEPO-AKtr_XIiij7Tj1xeFrFhl9UcP6mQdXHKg4Xu0ysxgszeb2ZeAMKPV2SOS0DT8K__ikGf8N_JhDdQGP6yiX-aH7vO6QWGMKDNN6Fg&x-client-SKU=ID_NET6_0&x-client-ver=6.15.1.0 - - - 200 2021 text/html;charset=UTF-8 671.7820ms [12:19:27 INF] Request starting HTTP/1.1 POST http://structureweb-authserver/connect/token application/x-www-form-urlencoded 188 [12:19:27 INF] The request URI matched a server endpoint: Token. [12:19:27 INF] The token request was successfully extracted: { "client_id": "StructureWeb_Web", "client_secret": "[redacted]", "code": "[redacted]", "grant_type": "authorization_code", "redirect_uri": "https://localhost:44353/signin-oidc" }. [12:19:27 INF] The response was successfully returned as a JSON document: { "error": "invalid_grant", "error_description": "The issuer associated to the specified token is not valid.", "error_uri": "https://documentation.openiddict.com/errors/ID2088" }. [12:19:27 INF] Request finished HTTP/1.1 POST http://structureweb-authserver/connect/token application/x-www-form-urlencoded 188 - 400 184 application/json;charset=UTF-8 107.0345ms [12:19:35 INF] Application is shutting down...

  • Docker-Compose.yml

version: '3.7'

services: structureweb-web: image: cfdata/structureweb-web:latest container_name: structureweb-web hostname: structureweb-web build: context: ../../../ dockerfile: aspnet-core/src/StructureWeb.Web/Dockerfile.local environment: - ASPNETCORE_URLS=https://+:443;http://+:80; - ASPNETCORE_ENVIRONMENT=Production - Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx - Kestrel__Certificates__Default__Password=91f91912-5ab0-49df-8166-23377efaf3cc - App__SelfUrl=https://localhost:44353 - App__CorsOrigins=https://localhost:44334 - AuthServer__RequireHttpsMetadata=false - AuthServer__IsContainerizedOnLocalhost=true - AuthServer__Authority=https://localhost:44334/ - RemoteServices__Default__BaseUrl=http://structureweb-host - RemoteServices__AbpAccountPublic__BaseUrl=http://structureweb-authserver - AuthServer__MetaAddress=http://structureweb-authserver - StringEncryption__DefaultPassPhrase=hsaEIdKpXAUfEH5D - ConnectionStrings__Default=Host=xxx.xxx.xxx.xxx;Port=5432;Database=StructureWebHost;User ID=xxx;Password=xxx;
- Redis__Configuration=redis - RabbitMQ__Connections__Default__HostName=rabbitmq - RabbitMQ__Connections__Default__UserName=guest - RabbitMQ__Connections__Default__Password=guest - RabbitMQ__EventBus__ClientName=StructureWeb - RabbitMQ__EventBus__ExchangeName=StructureWeb - RabbitMQ__EventBus__ConnectionName=PrimaryConnection ports: - "44353:443" depends_on: - structureweb.httpapi.host restart: on-failure volumes: - ./certs:/root/certificate - ./aspnet-core/src/tokens:/root/.abp/cli/ networks: - abp-network

structureweb.httpapi.host: container_name: structureweb-host hostname: structureweb-host image: cfdata/structureweb-api:latest build: context: ../../../ dockerfile: aspnet-core/src/StructureWeb.HttpApi.Host/Dockerfile.local environment: - ASPNETCORE_URLS=https://+:443;http://+:80; - ASPNETCORE_ENVIRONMENT=Production - Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx - Kestrel__Certificates__Default__Password=91f91912-5ab0-49df-8166-23377efaf3cc - App__SelfUrl=https://localhost:44354 - App__HealthCheckUrl=http://structureweb-host/health-status - AuthServer__RequireHttpsMetadata=false - AuthServer__Authority=http://structureweb-authserver - ConnectionStrings__Default=Host=xxx.xxx.xxx.xxx;Port=5432;Database=StructureWebHost;User ID=xxx;Password=xxx;
- StringEncryption__DefaultPassPhrase=hsaEIdKpXAUfEH5D - Redis__Configuration=redis - RabbitMQ__Connections__Default__HostName=rabbitmq - RabbitMQ__Connections__Default__UserName=guest - RabbitMQ__Connections__Default__Password=guest - RabbitMQ__EventBus__ClientName=StructureWebHttpApi - RabbitMQ__EventBus__ExchangeName=StructureWeb - RabbitMQ__EventBus__ConnectionName=PrimaryConnection ports: - "44354:443" depends_on: redis: condition: service_healthy restart: on-failure volumes: - ./certs:/root/certificate networks: - abp-network

structureweb-authserver: container_name: structureweb-authserver image: cfdata/structureweb-authserver:latest build: context: ../../../ dockerfile: aspnet-core/src/StructureWeb.AuthServer/Dockerfile.local environment: - ASPNETCORE_URLS=https://+:443;http://+:80; - ASPNETCORE_ENVIRONMENT=Production - Kestrel__Certificates__Default__Path=/root/certificate/localhost.pfx - Kestrel__Certificates__Default__Password=91f91912-5ab0-49df-8166-23377efaf3cc - App__SelfUrl=https://localhost:44334 - App__CorsOrigins=https://localhost:44353,https://localhost:44354 - AuthServer__RequireHttpsMetadata=false - AuthServer__Authority=http://structureweb-authserver - StringEncryption__DefaultPassPhrase=hsaEIdKpXAUfEH5D - ConnectionStrings__Default=Host=xxx.xxx.xxx.xxx;Port=5432;Database=StructureWebHost;User ID=xxx;Password=xxx;
- Redis__Configuration=redis - RabbitMQ__Connections__Default__HostName=rabbitmq - RabbitMQ__Connections__Default__UserName=guest - RabbitMQ__Connections__Default__Password=guest - RabbitMQ__EventBus__ClientName=StructureWebIdentityServer - RabbitMQ__EventBus__ExchangeName=StructureWeb - RabbitMQ__EventBus__ConnectionName=PrimaryConnection ports: - "44334:443" depends_on: redis: condition: service_healthy restart: on-failure volumes: - ./certs:/root/certificate - ./aspnet-core/src/tokens:/root/.abp/cli/ networks: - abp-network

db-migrator: image: cfdata/structureweb-db-migrator:latest container_name: structureweb-db-migrator build: context: ../../ dockerfile: aspnet-core/src/StructureWeb.DbMigrator/Dockerfile.local environment: - OpenIddict__Applications__StructureWeb_Web__RootUrl=https://localhost:44353 - OpenIddict__Applications__StructureWeb_Swagger__RootUrl=https://localhost:44354 - ConnectionStrings__Default=Host=xxx.xxx.xxx.xxx;Port=5432;Database=StructureWebHost;User ID=xxx;Password=xxx;
- Redis__Configuration=redis - RabbitMQ__Connections__Default__HostName=rabbitmq - RabbitMQ__Connections__Default__UserName=guest - RabbitMQ__Connections__Default__Password=guest - RabbitMQ__EventBus__ClientName=StructureWebDbMigrator - RabbitMQ__EventBus__ExchangeName=StructureWeb - RabbitMQ__EventBus__ConnectionName=PrimaryConnection
networks: - abp-network

redis: container_name: redis image: redis:alpine ports: - "6379:6379" networks: - abp-network healthcheck: test: ["CMD", "redis-cli","ping"]

rabbitmq: container_name: rabbitmq image: rabbitmq:management-alpine ports: - "15672:15672" - "5672:5672" networks: - abp-network

elsaserver: container_name: elsaserver image: elsaworkflows/elsa-dashboard-and-server:latest ports: - "13000:80" networks: - abp-network

networks: abp-network: name: structureweb-network driver: bridge


3 Answer(s)
  • User Avatar
    0
    gterdem created
    Support Team Senior .NET Developer

    Can you check the PreConfigureServices method of your AuthServerModule.

    Do you have the configuration below to set the issuer:

    PreConfigure<OpenIddictServerBuilder>(builder =>
    {
        builder.AddSigningCertificate(GetSigningCertificate(hostingEnvironment, configuration));
        builder.AddEncryptionCertificate(GetSigningCertificate(hostingEnvironment, configuration));
        builder.SetIssuer(new Uri(configuration["AuthServer:Authority"])); //this line
    });
    
  • User Avatar
    0
    Spospisil created

    I do not have this code in my solution but get when I add your code I get an error on the GetSigningCertificate method as it says it does not exist in the current context. What library is that contained within?

  • User Avatar
    0
    Spospisil created

    Disregard. I found the routine in a sample project generated with ABP Suite. Let me try a deployment to see if it fixes my issue.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11