marcospereirampj / python-keycloak

MIT License
692 stars 296 forks source link

refactor: incorporate custom headers into default header setup #533

Closed mattcollie closed 3 months ago

mattcollie commented 4 months ago

Hi this is my first contribution to this project, and I hope I'm doing this right. If there's anything I've missed or any additional information you need, please let me know.

Overview

Refactor of KeycloakOpenIDConnection, setting headers and custom_headers before any web request requiring any custom headers. This allows custom headers like Cloudflare access tokens to be included in the initial get_token() request.

Changes

This pull request refactors how default headers are set up. I've made modifications to ensure that custom headers, when provided, are incorporated correctly before any web requests.

The key changes include:

Reason

The motivation behind these changes is to ensure custom headers are available before any web requests requiring headers are made. This was a particular error when using KeycloakOpenIDConnection for KeycloakAdmin.