Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup keycloak multifactor authentication #185

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions importer/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
client_id=''
client_secret=''
fhir_base_url=''
keycloak_url=''
realm=''
product_access_token=''
username=''
password=''
access_token=''
refresh_token=''
18 changes: 16 additions & 2 deletions importer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def filter(self, record):
@click.option("--chunk_size", required=False, default=1000000)
@click.option("--resources_count", required=False, default=100)
@click.option("--list_resource_id", required=False)
@click.option("--multifactor_authenticaton", required=False, is_flag=True)
@click.option(
"--log_level", type=click.Choice(["DEBUG", "INFO", "ERROR"], case_sensitive=False)
)
Expand Down Expand Up @@ -144,9 +145,9 @@ def main(

logging.info("Starting csv import...")
json_path = "/".join([dir_path, "json_payloads/"])
resource_list = read_csv(csv_file)

if resource_list:
if csv_file is not None:
resource_list = read_csv(csv_file)
if resource_type == "users":
logging.info("Processing users")
with click.progressbar(
Expand Down Expand Up @@ -281,6 +282,19 @@ def main(
logging.error("Unsupported request!")
else:
logging.error("Empty csv file!")
if multifactor_authenticaton is not None:
# get details
response = handle_request(
"GET",payload = "", url="http://localhost:8082/admin/realms/master"
)
logging.error(response[0])

respons = handle_request(
"PUT",payload = response[0], url="http://localhost:8082/admin/realms/master/authentication/flows/browser/executions"
)

logging.error(respons)


if final_response and final_response.text:
logging.info('{ "final-response": ' + final_response.text + "}")
Expand Down