microsoft / microsoft/fhir-server

OpenID Authentication gives error when fhir-server run in container

Open
#5,188 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
TSQL
Stars
1.4k
Forks
592
Avg merge
2d 7h
Merged PRs (30d)
41

Description

fhir-server has built in identity provider for development (F5 experience). It works fine when running the code in debug mode in an IDE (e.g. Visual Studio). However if you build a local docker image run it as container locally, authentication doesn't work and it throws various errors. For example it throws invalid client id. Some times it throws JWT token could not be validated.

environment:
- DataStore=SqlServer
- SqlServer__Initialize=true
- SqlServer__AllowDatabaseCreation=true
- SqlServer__SchemaOptions__AutomaticUpdatesEnabled=true
- FhirServer__Security__Enabled=true
- FhirServer__Security__Authentication__Authority=https://fhir:8443/
- FhirServer__Security__Authentication__Audience=fhir-api
- DevelopmentIdentityProvider__Enabled=true
- TestAuthEnvironment__FilePath=/app/config/testauthenvironment.json
- ASPNETCORE_URLS=http://+:8080;https://+:8443

**FHIR Version?**
R4

**Data provider?**
SQL Server

**To Reproduce**
Steps to reproduce the behavior:
1. Copy repo to local IDE
2. build docker image, enable security
3. deploy image in a container
4. get access token
5. send CURL request to post a FHIR resource

**Expected behavior**
Request should be successful

**Actual behavior**
Throws error invalid token it could not be validated.

Issue is that JWT bearer token auth and OpenID are getting activated at the same time even if - DevelopmentIdentityProvider__Enabled=true

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the Docker-container flow with the listed authentication environment variables, then trace startup configuration for DevelopmentIdentityProvider and JWT bearer authentication. Done means a token obtained in the container is accepted by the curl request without invalid-client or JWT-validation errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, sql
Domain
authentication, backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.