Browse Source
Merge pull request #244 from cowofevil/keycloak_admin_with_auth_headers
Enable Keycloak Admin for Non-master Realms
pull/245/head^2
Marcos Pereira
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
10 additions and
6 deletions
-
keycloak/keycloak_admin.py
|
|
@ -2118,12 +2118,16 @@ class KeycloakAdmin: |
|
|
|
if self.user_realm_name: |
|
|
|
self.realm_name = self.user_realm_name |
|
|
|
|
|
|
|
if self.username and self.password: |
|
|
|
self._token = self.keycloak_openid.token(self.username, self.password, grant_type=grant_type) |
|
|
|
|
|
|
|
headers = { |
|
|
|
'Authorization': 'Bearer ' + self.token.get('access_token'), |
|
|
|
'Content-Type': 'application/json' |
|
|
|
} |
|
|
|
else: |
|
|
|
self._token = None |
|
|
|
headers = {} |
|
|
|
|
|
|
|
if self.custom_headers is not None: |
|
|
|
# merge custom headers to main headers |
|
|
|