mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-22 05:09:12 +00:00
[PR #11557/a69f7e60 backport][stable-12] add module keycloak_authentication_v2 (#11579)
add module keycloak_authentication_v2 (#11557)
* add module keycloak_authentication_v2
* skip sanity checks, because the run into a recursion
* 11556 fix documentation
* 11556 limit the depth of nested flows to 4
* 11556 code cleanup
* 11556 code cleanup - add type hints
* 11556 add keycloak_authentication_v2 to meta/runtime.yml
* 11556 code cleanup - remove custom type hints
* 11556 code cleanup - none checks
* Update plugins/modules/keycloak_authentication_v2.py
* Update plugins/modules/keycloak_authentication_v2.py
* 11556 code cleanup - remove document starts
* 11556 cleanup
* 11556 cleanup
---------
(cherry picked from commit a69f7e60b4)
Co-authored-by: thomasbargetz <thomas.bargetz@gmail.com>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Thomas Bargetz <thomas.bargetz@rise-world.com>
This commit is contained in:
parent
25e35bdda7
commit
5106aa8065
18 changed files with 1765 additions and 0 deletions
|
|
@ -2274,6 +2274,35 @@ class KeycloakAPI:
|
|||
except Exception as e:
|
||||
self.fail_request(e, msg=f"Unable get authentication flow {alias}: {e}")
|
||||
|
||||
def get_authentication_flow_by_id(self, id, realm: str = "master"):
|
||||
"""
|
||||
Get an authentication flow by its id
|
||||
:param id: id of the authentication flow to get.
|
||||
:param realm: Realm.
|
||||
:return: Authentication flow representation.
|
||||
"""
|
||||
flow_url = URL_AUTHENTICATION_FLOW.format(url=self.baseurl, realm=realm, id=id)
|
||||
|
||||
try:
|
||||
return json.load(self._request(flow_url, method="GET"))
|
||||
except Exception as e:
|
||||
self.fail_request(e, msg=f"Could not get authentication flow {id} in realm {realm}: {e}")
|
||||
|
||||
def update_authentication_flow(self, id, config, realm: str = "master"):
|
||||
"""
|
||||
Updates an authentication flow
|
||||
:param id: id of the authentication flow to update.
|
||||
:param config: Authentication flow configuration.
|
||||
:param realm: Realm.
|
||||
:return: Authentication flow representation.
|
||||
"""
|
||||
flow_url = URL_AUTHENTICATION_FLOW.format(url=self.baseurl, realm=realm, id=id)
|
||||
|
||||
try:
|
||||
return self._request(flow_url, method="PUT", data=json.dumps(config))
|
||||
except Exception as e:
|
||||
self.fail_request(e, msg=f"Could not get authentication flow {id} in realm {realm}: {e}")
|
||||
|
||||
def delete_authentication_flow_by_id(self, id, realm: str = "master"):
|
||||
"""
|
||||
Delete an authentication flow from Keycloak
|
||||
|
|
@ -2379,6 +2408,22 @@ class KeycloakAPI:
|
|||
except Exception as e:
|
||||
self.fail_request(e, msg=f"Unable to add authenticationConfig {executionId}: {e}")
|
||||
|
||||
def update_authentication_config(self, configId, authenticationConfig, realm: str = "master"):
|
||||
"""
|
||||
Updates an authentication config
|
||||
:param configId: id of the authentication config
|
||||
:param authenticationConfig: The authentication config
|
||||
:param realm: realm of authentication config
|
||||
"""
|
||||
try:
|
||||
self._request(
|
||||
URL_AUTHENTICATION_CONFIG.format(url=self.baseurl, realm=realm, id=configId),
|
||||
method="PUT",
|
||||
data=json.dumps(authenticationConfig),
|
||||
)
|
||||
except Exception as e:
|
||||
self.fail_request(e, msg=f"Unable to update the authentication config {configId}: {e}")
|
||||
|
||||
def delete_authentication_config(self, configId, realm: str = "master"):
|
||||
"""Delete authenticator config
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue