Open rehammuzzamil opened 3 years ago
A quick update regarding initial RnD:
html/text
format. The CapabilityStatement
can be customized by creating a server interceptor and registering it against the server. This interceptor should implement a hook method for the SERVER_CAPABILITY_STATEMENT_GENERATED
pointcut. html/text
content type as the current flow fails to parse it and throws the same exception. FHIRContext
class.Based on initial high-level RnD Pros:
Cons:
I will proceed with the in-depth RnD and share further details here. Please feel free to share your thoughts and comments on which approach should be used for further investigation. @dubdabasoduba cc : @f-odhiambo @maimoonak
Fix broken web UI (Test page overlay) by providing Authentication support.
Cause of broken UI Due to the Keycloak Security Configuration brought into the JPA Server code, API redirects it to the default login page of the Keycloak as per the default behavior that response is in the
html/text
format. But as per theCapabilityStatement.class
, the mentioned content type is not supported by the API content type. This breaks while fetching and loading the Conformance Statement that has all the set of rules to which the FHIR Application is compliant. It throws away NonFHIRResponseException at https://github.com/opensrp/hapi-fhir/blob/38436e5c1bd04e7a4ca81f078eb18ddabc2bd533/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/BaseClient.java#L576Possible Solution
Redirect to the default Keycloak Login form whenever "/" end-point is triggered
Save username/password in a map (until a session is expired) to be used later
Keycloak Fetch Token API should be triggered every time an API is triggered
Introduce an Interceptor to add an
Authorization
header with theBearer token
fetched abovePossible Hook to be used here is:
@Hook(Pointcut.SERVER_INCOMING_REQUEST_PRE_PROCESSED)
We need to add logic to check if there is an already existing
Authorization header
present in the HTTP Request then skip this step.Challenges/Open questions
cc: @f-odhiambo @dubdabasoduba