diff --git a/src/keycloak/keycloak_admin.py b/src/keycloak/keycloak_admin.py index 26792f5..d985c1d 100644 --- a/src/keycloak/keycloak_admin.py +++ b/src/keycloak/keycloak_admin.py @@ -54,6 +54,8 @@ class KeycloakAdmin: :type username: str :param password: admin password :type password: str + :param token: access and refresh tokens + :type token: dict :param totp: Time based OTP :type totp: str :param realm_name: realm name @@ -88,7 +90,6 @@ class KeycloakAdmin: _client_secret_key = None _auto_refresh_token = None _connection = None - _token = None _custom_headers = None _user_realm_name = None @@ -97,6 +98,7 @@ class KeycloakAdmin: server_url, username=None, password=None, + token=None, totp=None, realm_name="master", client_id="admin-cli", @@ -115,6 +117,8 @@ class KeycloakAdmin: :type username: str :param password: admin password :type password: str + :param token: access and refresh tokens + :type token: dict :param totp: Time based OTP :type totp: str :param realm_name: realm name @@ -139,6 +143,7 @@ class KeycloakAdmin: self.server_url = server_url self.username = username self.password = password + self.token = token self.totp = totp self.realm_name = realm_name self.client_id = client_id @@ -150,7 +155,8 @@ class KeycloakAdmin: self.timeout = timeout # Get token Admin - self.get_token() + if not self.token: + self.get_token() @property def server_url(self):