Skip to content
Open
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
23 changes: 23 additions & 0 deletions src/ol_infrastructure/substructure/keycloak/olapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1487,6 +1487,29 @@ def create_olapps_realm( # noqa: PLR0913, PLR0915
)
# MASAI SCHOOL [END]

onboard_oidc_org(
OIDCIdpConfig(
idp_alias="APPLY7",
idp_display_name="Apply7",
org_oidc_metadata_url="https://keycloak.apply7.cn/realms/mit-learn/.well-known/openid-configuration",
realm_id=ol_apps_realm.id,
first_login_flow=ol_first_login_flow,
resource_options=resource_options,
client_id="mit-learn",
),
org=OrgConfig(
# Same as upGrad/Masai School: Apply7 users log in via a
# direct kc_idp_hint link, not domain-based home-realm
# discovery, so no domain is needed to gate access.
org_domains=[],
org_name="Apply7",
org_alias="APPLY7",
learn_domain=mitlearn_domain,
realm_id=ol_apps_realm.id,
resource_options=resource_options,
),
)
Comment on lines +1501 to +1511

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The Apply7 OIDC provider configuration lacks a client_secret, which can lead to a silent failure during pulumi up if the IdP doesn't support private_key_jwt or is unreachable.
Severity: HIGH

Suggested Fix

Verify with the Apply7 team whether their Keycloak instance supports private_key_jwt authentication. If it does not, a client_secret must be obtained and added to the OIDCIdpConfig for Apply7. If it does, ensure the metadata URL is consistently accessible. Consider adding an explicit failure (e.g., raising an exception) instead of a silent return with a warning log to make this failure mode more visible during deployment.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/ol_infrastructure/substructure/keycloak/olapps.py#L1490-L1511

Potential issue: The new OIDC configuration for Apply7 in `olapps.py` omits the
`client_secret`. When `client_secret` is `None`, the
`oidc_identity_provider_args_from_discovery_url` function requires the identity
provider's metadata to advertise `private_key_jwt` support. If Apply7's Keycloak
instance does not support this (which is the default for Keycloak) or if its metadata
URL is inaccessible, the function returns `None`. This causes the `onboard_oidc_org`
function to log a warning and exit prematurely. The `pulumi up` process will report
success, but the identity provider will not be created, preventing Apply7 users from
authenticating. The PR description notes this configuration is currently unverified.

Did we get this right? 👍 / 👎 to inform future reviews.


# B2B Organizations [END]

if stack_info.env_suffix in ["ci", "qa"]:
Expand Down