@@ -30,6 +30,7 @@ import type { Request, Response } from 'express'
3030import { Container } from 'typedi'
3131import OBPClientService from '../services/OBPClientService.js'
3232import { OAuth2ProviderManager } from '../services/OAuth2ProviderManager.js'
33+ import { OAuth2ProviderFactory } from '../services/OAuth2ProviderFactory.js'
3334import { commitId } from '../app.js'
3435import {
3536 RESOURCE_DOCS_API_VERSION ,
@@ -42,6 +43,42 @@ const router = Router()
4243// Get services from container
4344const obpClientService = Container . get ( OBPClientService )
4445const providerManager = Container . get ( OAuth2ProviderManager )
46+ const providerFactory = Container . get ( OAuth2ProviderFactory )
47+
48+ /**
49+ * Map provider name to the expected environment variable names
50+ */
51+ function getProviderEnvVarNames ( providerName : string ) : { clientId : string ; clientSecret : string } {
52+ const mapping : Record < string , { clientId : string ; clientSecret : string } > = {
53+ 'obp-oidc' : {
54+ clientId : 'VITE_OBP_OIDC_CLIENT_ID' ,
55+ clientSecret : 'VITE_OBP_OIDC_CLIENT_SECRET'
56+ } ,
57+ 'keycloak' : {
58+ clientId : 'VITE_KEYCLOAK_CLIENT_ID' ,
59+ clientSecret : 'VITE_KEYCLOAK_CLIENT_SECRET'
60+ } ,
61+ 'google' : {
62+ clientId : 'VITE_GOOGLE_CLIENT_ID' ,
63+ clientSecret : 'VITE_GOOGLE_CLIENT_SECRET'
64+ } ,
65+ 'github' : {
66+ clientId : 'VITE_GITHUB_CLIENT_ID' ,
67+ clientSecret : 'VITE_GITHUB_CLIENT_SECRET'
68+ }
69+ }
70+
71+ if ( mapping [ providerName ] ) {
72+ return mapping [ providerName ]
73+ }
74+
75+ // Generic fallback for custom/unknown providers
76+ const upperName = providerName . toUpperCase ( ) . replace ( / - / g, '_' )
77+ return {
78+ clientId : `VITE_${ upperName } _CLIENT_ID` ,
79+ clientSecret : `VITE_${ upperName } _CLIENT_SECRET`
80+ }
81+ }
4582
4683const connectors = [
4784 'akka_vDec2018' ,
@@ -199,14 +236,25 @@ router.get('/status/providers', (req: Request, res: Response) => {
199236 }
200237 }
201238
239+ // Get factory-configured strategies (env vars loaded) vs discovered providers
240+ const configuredStrategies = providerFactory . getConfiguredProviders ( )
241+
242+ // Build per-provider explorer readiness
243+ const explorerReadiness = allProviderStatus . map ( ( status ) => ( {
244+ ...status ,
245+ explorerCredentialsConfigured : providerFactory . hasStrategy ( status . name ) ,
246+ explorerEnvVars : getProviderEnvVarNames ( status . name )
247+ } ) )
248+
202249 res . json ( {
203250 summary : {
204251 totalConfigured : availableProviders . length ,
205252 availableProviders : availableProviders ,
206253 obpApiHost : process . env . VITE_OBP_API_HOST || 'not configured' ,
207- sharedRedirectUrl : sharedRedirectUrl
254+ sharedRedirectUrl : sharedRedirectUrl ,
255+ explorerConfiguredStrategies : configuredStrategies
208256 } ,
209- providerStatus : allProviderStatus ,
257+ providerStatus : explorerReadiness ,
210258 environmentConfig : envConfig ,
211259 note : 'Credentials are masked for security. Format: first2...last2'
212260 } )
@@ -295,6 +343,8 @@ router.get('/status/oidc-debug', async (req: Request, res: Response) => {
295343 providerName : provider . provider ,
296344 wellKnownUrl : provider . url ,
297345 success : false ,
346+ explorerCredentialsConfigured : providerFactory . hasStrategy ( provider . provider ) ,
347+ explorerEnvVars : getProviderEnvVarNames ( provider . provider ) ,
298348 oidcConfiguration : null as any ,
299349 error : null as string | null ,
300350 endpoints : {
@@ -398,6 +448,8 @@ router.get('/status/oidc-debug', async (req: Request, res: Response) => {
398448 }
399449
400450 // Compile summary
451+ const explorerConfiguredStrategies = providerFactory . getConfiguredProviders ( )
452+
401453 const summary = {
402454 timestamp : new Date ( ) . toISOString ( ) ,
403455 obpApiReachable : step1 . success ,
@@ -407,7 +459,8 @@ router.get('/status/oidc-debug', async (req: Request, res: Response) => {
407459 currentlyAvailable : availableProviders . length ,
408460 configuredInEnvironment : Object . values ( envConfig ) . filter (
409461 ( c ) => typeof c === 'object' && 'configured' in c && c . configured
410- ) . length
462+ ) . length ,
463+ explorerConfiguredStrategies
411464 }
412465
413466 res . json ( {
0 commit comments