Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable Basic Auth #4003

Open
sidharthramesh opened this issue Oct 4, 2022 · 1 comment
Open

Cannot disable Basic Auth #4003

sidharthramesh opened this issue Oct 4, 2022 · 1 comment
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation P2 Priority 2 - Should Have

Comments

@sidharthramesh
Copy link

Describe the bug
Setting security.basic.enabled to "false" does not disable Basic Authentication

Environment
Which version of LinuxForHealth FHIR Server?
Docker image ghcr.io/linuxforhealth/fhir-server:5.0.0-rc2

To Reproduce
Steps to reproduce the behavior:
Use the following fhir-server-config.json

{
  "__comment": "FHIR Server configuration",
  "fhirServer": {
    "core": {
      "tenantIdHeaderName": "X-FHIR-TENANT-ID",
      "datastoreIdHeaderName": "X-FHIR-DSID",
      "originalRequestUriHeaderName": "X-FHIR-FORWARDED-URL",
      "checkReferenceTypes": true,
      "conditionalDeleteMaxNumber": 10,
      "__comment": "The Server Registry Resource Provider is a server-wide setting. The default is false, and the CI changes to true in the build and test.",
      "serverRegistryResourceProviderEnabled": false,
      "disabledOperations": ""
    },
    "security": {
      "cors": true,
      "basic": {
        "enabled": false
      },
      "certificates": {
        "enabled": false
      },
      "oauth": {
        "enabled": false,
        "regUrl": "https://<host>:9443/oauth2/endpoint/oauth2-provider/registration",
        "authUrl": "https://<host>:9443/oauth2/endpoint/oauth2-provider/authorize",
        "tokenUrl": "https://<host>:9443/oauth2/endpoint/oauth2-provider/token",
        "openEhrUrl": "https://<host>:9443/endpoint/open-ehr",
        "smart": {
          "enabled": true,
          "scopes": [
            "openid",
            "profile",
            "fhirUser",
            "launch/patient",
            "patient/*.*",
            "offline_access"
          ],
          "openehr": {
            "openEhrUrl": "https://<host>:9443/endpoint/open-ehr/url/test"
          },
          "capabilities": [
            "sso-openid-connect",
            "launch-standalone",
            "client-public",
            "client-confidential-symmetric",
            "permission-offline",
            "context-standalone-patient",
            "permission-patient"
          ]
        }
      }
    },
    "audit": {
      "serviceClassName": "org.linuxforhealth.fhir.audit.impl.NopService",
      "serviceProperties": {}
    },
    "persistence": {
      "factoryClassname": "org.linuxforhealth.fhir.persistence.jdbc.FHIRPersistenceJDBCFactory",
      "common": {
          "__comment": "Configuration properties common to all persistence layer implementations",
          "updateCreateEnabled": true
      },
      "jdbc": {
          "__comment": "Configuration properties for the JDBC persistence implementation",
          "enableCodeSystemsCache": true,
          "enableParameterNamesCache": true,
          "enableResourceTypesCache": true
      },
      "datasources": {
          "default": {
              "type": "postgresql",
              "currentSchema": "fhirdata",
              "jndiName": "jdbc/fhir_default_default",
              "searchOptimizerOptions": {
                  "from_collapse_limit": 12,
                  "join_collapse_limit": 12
              }
          }
      }
    },
    "term": {
      "remoteTermServiceProviders": [{
        "__comment": "Configuration for public SNOMED-CT endpoint",
        "enabled": true,
        "base": "https://snowstorm-fhir.snomedtools.org/fhir",
        "supports": [{
            "system": "http://snomed.info/sct"
        }]
      }]
    },
    "operations": {
      "erase": {
        "enabled": true,
        "allowedRoles": ["FHIROperationAdmin", "FHIRUsers"]
      }
    }
  }
}

Enabled http endpoint on port 8080 in server.xml

GET Request on http://localhost:8080/fhir-server/api/v4/Patient requires basic authentication. Failed with 401 without it.

Expected behavior
200 OK

Additional context
Add any other context about the problem here.

@sidharthramesh sidharthramesh added the bug Something isn't working label Oct 4, 2022
@lmsurpre
Copy link
Member

lmsurpre commented Oct 4, 2022

Thanks @sidharthramesh we need to beef up our documentation here. The fhir-server-config.json security section is more about advertising what security is enabled (e.g. for building the server's CapabilityStatement which is hosted from the /metadata endpoint).

One reason for this to be disconnected from the actual enforcement on the server is that often times we'll use a gateway in front of the server and so, for example, you might have OAuth enforced at that level but you still want the server to say its secured by OAuth.

To actually disable basic auth you can add the linked snippet under configDropins/overrides: #1020 (comment)

@lmsurpre lmsurpre added the documentation Improvements or additions to documentation label Oct 4, 2022
@lmsurpre lmsurpre added the P2 Priority 2 - Should Have label Nov 2, 2022
@PrasannaHegde1 PrasannaHegde1 self-assigned this Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation P2 Priority 2 - Should Have
Projects
None yet
Development

No branches or pull requests

3 participants