Feature/add bearer token authentification#3
Conversation
Introduce Keycloak token management with prioritized authentication (Keycloak token, static bearer token, and basic auth). Add `KeycloakTokenManager` for token retrieval and caching. Update FHIR client to support bearer token authentication.
…d race conditions and initialization issues
…es in `application.yml` and update `.gitignore` to exclude `.env` files.
…2Mii` constructor (for fail-fast-principle and readability)
patrick-skowronek
left a comment
There was a problem hiding this comment.
Thank you @Saskia32123 .
I have some comments and I need to apologize for the bad code 😅
- I would introduce a enum type for the authentication. Which is either a keycloak, static or basic auth. This would make the code cleaner. With @ConfigurationProperties you can do that. This would is then needed twice for the source and target.
- Some of the logs are quite bad, even before your PR. If you can change them, that would be nice. Otherwise I will improve them after this PR.
Hi @patrick-skowronek the code gets the job done :) To your points:
|
- Introduce `AuthType` enum and - Refactor FHIR server configuration to support authentication types and retrieve via ConfigurationProperties - Streamline `Configuration` class, and update `application.yml`.
- Replace priority-based auth logic with `AuthType`-based switch cases. - Add validation for Keycloak, Bearer, and Basic auth configurations. - Simplify source and target FHIR server initialization.
I implemented it like you suggested, but for a clear structure it maybe makes sense to differentiate between protocols and providers? |
Did you commit and pushed it already? From a code perspective it would be nice to have a switch case with all the options we provide. I think we don't support api keys. With you addition we would then support bearer token. |
Hier der Pull Request für die Bearertokenauthentifizierung + ein paar kleinere Improvements