-
Notifications
You must be signed in to change notification settings - Fork 159
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
invalid OAuth2 (Keycloak) connection to FHIR #1703
Comments
I'm not sure if its your issue or not, but I've had troubles with using this special-subject together with the JAX-RS security annotations I added to our REST layer. I opened #1020 and I'm waiting for a fix from the OpenLiberty project. Its also worth mentioning that I've moved to the use of the liberty
I hope to document this better when I get to #1546 |
Final ReportThanks to @lmsurpre's help via FHIR Chat, i managed to solve my problem. 1. FHIR-Server Configuration:You have to modify/create the following files and place them within the specified sub-directory of your 1.1
|
Variable | Value |
---|---|
Client ID | CLIENT_ID |
Client Protocol | openid-connect |
Root URL | FHIR_SERVER_URL /fhir-server/api/v4 |
Make sure, the client configuration matches the following:
(all variables that are not mentioned here, are optional / irrelevant for our purpose)
Variable | Value |
---|---|
Client ID | CLIENT_ID |
Access type | confidential |
Direct Access Grants Enabled | ON |
Service Accounts Enabled | ON |
Authorization Enabled | OFF |
Root URL | FHIR_SERVER_URL /fhir-server/api/v4 |
Valid Redirect URLs | FHIR_SERVER_URL /oidcclient/redirect/ CLIENT_ID |
Switch to Tab "Credentials" and save the Client Secret as displayed. (or copy/paste it directly to your .env
-File)
Switch to Tab "Mappers", click "Create" and create a mapper as follows:
Variable | Value |
---|---|
Mapper Type | Audience |
Included Client Audience | leave empty |
Included Custom Audience | FHIR_SERVER_URL /fhir-server/api/v4 |
Add to ID token | OFF |
Add to access token | ON |
This mapper is used by mpJwt -component of the FHIR-Server to map requests that are authenticated using user-credentials. (Keycloak users of a given group) |
Client Scope:
-
open section "Client Scopes"
-
create client scope
CLIENT ID
with default settings -
switch to tab "Mappers", create new Mapper:
Variable Value Mapper Type Audience Included Client Audience CLIENT ID
Included Custom Audience leave empty Add to ID token OFF Add to access token ON This mapper is used by openidConnectClient
-component of the FHIR-Server to map requests that are authenticated using ClientID & Secret. (e.g. Client-to-Client requests) -
make sure the created client scope is added to the client's client scopes:
Section "Client", editCLIENT ID
, Tab "Client Scopes",
assign client scope to default client scopes)
User Management:
- add existing Keycloak-Users to realm (& client), assign necessary permissions (e.g. for realm/client administration)
- Optional: create users where only
Username
andPassword
need to be set. (e.g. for automated CLI/API usage) - create User Group
fhirUser
- add all relevant users to group
fhirUser
Only registered users or clients providing ClientID
&Client Secret
are allowed to make API calls or access the FHIR-Server via Browser.
Describe the bug
After managing to integrate Keycloak into the FHIR-Authentication process, Login via Browser works fine. (Access FHIR-Url, redirect to Keycloak, Login, redirect back to FHIR)
When attempting to access the FHIR-server via command-line, FHIR-client, or Postman, (even with Bearer-Token supplied) one gets informed that FHIR wants to redirect to the Keycloak-Login page.
Is there any configuration on enabling login-token handling?
To Reproduce
Steps to reproduce the behavior:
.../fhir-server/api/v4
)Expected behavior
Accept the token as Login-Method
Additional context
IBM-FHIR version 4.4.2 (occured already with version 4.3.3)
Configuration in
server.xml
:Configuration of
oauthResourceServer.xml
:Keycloak settings:
The text was updated successfully, but these errors were encountered: