-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add Keycloak details in CI run #57
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||
| cyverse: | ||||||
| title: "Cyverse SSO" | ||||||
| description: Cyverse SSO | ||||||
| base_url: https://keycloak.cyverse.at | ||||||
| realm: CyVerse | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| app_key: CYVERSE_KEYCLOAK_APP_CREDENTIALS | ||||||
| legacy_url_path: False | ||||||
|
|
||||||
| meduni: | ||||||
| title: Meduni SSO | ||||||
| description: Meduni SSO | ||||||
| base_url: https://openid.medunigraz.at/ | ||||||
| realm: invenioRDM | ||||||
| app_key: KEYCLOAK_APP_CREDENTIALS | ||||||
| legacy_url_path: False | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| """ | ||
| Script that injects a given yaml config into arguments of an invenio.cfg class. | ||
| """ | ||
|
|
||
| import yaml | ||
| import sys | ||
| import argparse | ||
|
|
||
| parser = argparse.ArgumentParser() | ||
|
|
||
| parser.add_argument('--source-filename', type=str, required=True) | ||
| parser.add_argument('--dest-filename', type=str, required=True) | ||
| parser.add_argument('--node', type=str, required=True) | ||
| parser.add_argument('--placeholder', type=str, required=True) | ||
|
|
||
| args = parser.parse_args() | ||
|
|
||
| auth_config = "" | ||
| with open(args.source_filename) as f: | ||
| data = yaml.safe_load(f) | ||
| for key, _ in data.items(): | ||
| if key == args.node: | ||
| for node_key, val in data[key].items(): | ||
| if isinstance(val, str): | ||
| auth_config += f'{node_key}="{val}",\n' | ||
| else: | ||
| auth_config += f'{node_key}={val},\n' | ||
|
|
||
| with open(args.dest_filename, "r") as f: | ||
| config = f.read() | ||
| config = config.replace(args.placeholder, auth_config) | ||
|
|
||
| with open(args.dest_filename, "w") as f: | ||
| f.write(config) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -392,12 +392,7 @@ GLOBAL_SEARCH_SCHEMAS = { | |
| # Keycloak configurations | ||
| # ============================================================================ | ||
| _keycloak_helper = KeycloakSettingsHelper( | ||
| title="Meduni SSO", | ||
| description="Meduni SSO", | ||
| base_url="https://openid.medunigraz.at/", | ||
| realm="invenioRDM", | ||
| app_key="KEYCLOAK_APP_CREDENTIALS", | ||
| legacy_url_path=False | ||
| <insert_keycloak_config_via_ci> | ||
| ) | ||
|
|
||
| OAUTHCLIENT_KEYCLOAK_REALM_URL = _keycloak_helper.realm_url | ||
|
|
@@ -407,25 +402,13 @@ OAUTHCLIENT_KEYCLOAK_VERIFY_AUD = True # whether to verify the audience tag for | |
| OAUTHCLIENT_KEYCLOAK_AUD = "inveniordm" # probably the same as the client ID | ||
| OAUTHCLIENT_KEYCLOAK_USER_INFO_FROM_ENDPOINT = True | ||
|
|
||
| # Cyverse SSO (commented out – uncomment to re-enable) | ||
| # _cyverse_keycloak_helper = KeycloakSettingsHelper( | ||
| # title="Cyverse SSO", | ||
| # description="Cyverse SSO", | ||
| # base_url="https://keycloak.cyverse.at", | ||
| # realm="CyVerse", | ||
| # app_key="CYVERSE_KEYCLOAK_APP_CREDENTIALS", | ||
| # ) | ||
| # OAUTHCLIENT_CYVERSE_REALM_URL = _cyverse_keycloak_helper.realm_url | ||
| # OAUTHCLIENT_CYVERSE_USER_INFO_URL = _cyverse_keycloak_helper.user_info_url | ||
| # OAUTHCLIENT_CYVERSE_VERIFY_EXP = True | ||
| # OAUTHCLIENT_CYVERSE_VERIFY_AUD = True | ||
| # OAUTHCLIENT_CYVERSE_AUD = "inveniordm" | ||
| # OAUTHCLIENT_CYVERSE_USER_INFO_FROM_ENDPOINT = True | ||
|
|
||
| """ | ||
| Keycloak settings like base_url and realm should be set by CI by replacing for | ||
| the placeholder this instance. | ||
| """ | ||
|
|
||
| OAUTHCLIENT_REMOTE_APPS = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we will have only one app which will have the configuration injected at CI runtime. maybe as a future task we could extend the template to add multiple configs/apps. |
||
| "keycloak": _keycloak_helper.remote_app | ||
| # "cyverse": _cyverse_keycloak_helper.remote_app, | ||
| "keycloak": _keycloak_helper.remote_app, | ||
| } | ||
|
|
||
| ## SET THE CREDENTIALS via .env | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.