From 2725b9421de35afa0659d10533c7883eec2526f4 Mon Sep 17 00:00:00 2001 From: Ramgopal Nagaboina Date: Thu, 17 Sep 2026 16:40:28 -0400 Subject: [PATCH] oauth2: add a generic OIDC provider type The OAuth2 plugin resolves a login to a UserOAuth2Authenticator through a fixed provider-name to Spring-bean map, and each OIDC vendor is its own bean running the same authorization-code flow with no vendor-specific logic. A new IdP needs a new class, and since provider is both the display name and the routing key, a domain can register only one keycloak. This adds a type column to oauth_provider. OAuth2AuthManagerImpl looks the name up in the bean map first and only on a miss falls back to the registration's type, so provider becomes an admin-chosen label and type selects the implementation. One bean then serves any number of registrations under arbitrary names. Existing google, github and keycloak rows carry a null type and dispatch by name as before. GenericOIDCOAuth2Provider is registered under type oidc and configured with the issuer URL. It reads the token and JWKS endpoints from the issuer's discovery document (the issuer must match), and validates the id_token before trusting it: signature against the JWKS key named by the token kid, then issuer, audience and expiry, using the CXF JOSE library already on the classpath. It holds no token state between logins, and a code verified through verifyOAuthCodeAndGetUser is redeemed once so the following oauthlogin does not re-present it. ListOAuthProvidersCmd and UpdateOAuthProviderCmd derived the response enabled flag from a name-to-bean check, which reported every generically-named registration as disabled; both now also accept a registration whose type resolves to a plugin. The schema change adds type and issuer_url to oauth_provider in the 4.23.0.0 to 24.0.0 upgrade file. Login.vue renders the OAuth buttons from the registered provider list so a generic oidc provider gets a Sign in with