Skip to content

feat(keycloak): onboard Apply7 as an OIDC identity provider - #5638

Open
shaidar wants to merge 1 commit into
mainfrom
feat/apply7-oidc-idp
Open

feat(keycloak): onboard Apply7 as an OIDC identity provider#5638
shaidar wants to merge 1 commit into
mainfrom
feat/apply7-oidc-idp

Conversation

@shaidar

@shaidar shaidar commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

N/A

Description (What does it do?)

Onboards Apply7 (apply7.ai) as a new OIDC identity provider on the olapps (MIT Learn) Keycloak realm, using the existing onboard_oidc_org/OIDCIdpConfig/OrgConfig helpers in org_sso_helpers.py.

  • IdP alias: APPLY7, client ID: mit-learn
  • Metadata URL: https://keycloak.apply7.cn/realms/mit-learn/.well-known/openid-configuration
  • org_domains is intentionally empty — like upGrad and Masai School, Apply7 users authenticate via a direct kc_idp_hint link rather than domain-based home-realm discovery, so no email domain is needed to gate access.
  • No client_secret configured (same pattern as several other partners, e.g. DUTH).

Screenshots (if appropriate):

N/A — backend Keycloak config only.

How can this be tested?

  • ruff format, ruff check, and mypy all pass via pre-commit.
  • After merge/apply, verify in the Keycloak admin console that the APPLY7 identity provider appears under the olapps realm and that a kc_idp_hint=apply7 login link successfully redirects to https://keycloak.apply7.cn/realms/mit-learn/... and completes the OIDC flow with a test account.

Additional Context

Apply7 also asked whether MIT can provide "the public certificate for certificate-based authentication." That doesn't map to anything in this OIDC flow as configured — Keycloak validates Apply7's signature via the JWKS published at their own metadata URL, so there's no MIT-side certificate to hand over unless they actually intend mutual TLS or private_key_jwt client auth (the pattern already used for Masai School). Worth clarifying with their team before end-to-end testing.

Adds Apply7 (apply7.ai) to the olapps realm following the same
domain-less, kc_idp_hint-based pattern used for upGrad and Masai School.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings August 28, 2026 16:04
Comment on lines +1501 to +1511
# 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,
),
)

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Apply7 as a production OIDC provider for the MIT Learn Keycloak realm.

Changes:

  • Configures the Apply7 OIDC provider and organization.
  • Enables direct kc_idp_hint=apply7 login without domain discovery.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

realm_id=ol_apps_realm.id,
first_login_flow=ol_first_login_flow,
resource_options=resource_options,
client_id="mit-learn",
@blarghmatey

Copy link
Copy Markdown
Member

Don't we also need to add some attribute mappers for them to do attribution of schools, etc.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants