Browse Source

refactor: Merge branch 'master' into feature/cicd

pull/309/head
Richard Nemeth 3 years ago
parent
commit
ded35ff70c
No known key found for this signature in database GPG Key ID: 21C39470DF3DEC39
  1. 14
      keycloak/keycloak_admin.py

14
keycloak/keycloak_admin.py

@ -123,6 +123,7 @@ class KeycloakAdmin:
_server_url = None _server_url = None
_username = None _username = None
_password = None _password = None
_totp = None
_realm_name = None _realm_name = None
_client_id = None _client_id = None
_verify = None _verify = None
@ -138,6 +139,7 @@ class KeycloakAdmin:
server_url, server_url,
username=None, username=None,
password=None, password=None,
totp=None,
realm_name="master", realm_name="master",
client_id="admin-cli", client_id="admin-cli",
verify=True, verify=True,
@ -151,6 +153,7 @@ class KeycloakAdmin:
:param server_url: Keycloak server url :param server_url: Keycloak server url
:param username: admin username :param username: admin username
:param password: admin password :param password: admin password
:param totp: Time based OTP
:param realm_name: realm name :param realm_name: realm name
:param client_id: client id :param client_id: client id
:param verify: True if want check connection SSL :param verify: True if want check connection SSL
@ -162,6 +165,7 @@ class KeycloakAdmin:
self.server_url = server_url self.server_url = server_url
self.username = username self.username = username
self.password = password self.password = password
self.totp = totp
self.realm_name = realm_name self.realm_name = realm_name
self.client_id = client_id self.client_id = client_id
self.verify = verify self.verify = verify
@ -237,6 +241,14 @@ class KeycloakAdmin:
def password(self, value): def password(self, value):
self._password = value self._password = value
@property
def totp(self):
return self._totp
@totp.setter
def totp(self, value):
self._totp = value
@property @property
def token(self): def token(self):
return self._token return self._token
@ -2434,7 +2446,7 @@ class KeycloakAdmin:
if self.username and self.password: if self.username and self.password:
self._token = self.keycloak_openid.token( self._token = self.keycloak_openid.token(
self.username, self.password, grant_type=grant_type
self.username, self.password, grant_type=grant_type, totp=self.totp
) )
headers = { headers = {

Loading…
Cancel
Save