@@ -30,6 +30,7 @@ import type { Request, Response } from 'express'
3030import { Container } from 'typedi'
3131import OBPClientService from '../services/OBPClientService.js'
3232import { OAuth2Service } from '../services/OAuth2Service.js'
33+ import { OAuth2ProviderManager } from '../services/OAuth2ProviderManager.js'
3334import { commitId } from '../app.js'
3435import {
3536 RESOURCE_DOCS_API_VERSION ,
@@ -42,8 +43,14 @@ const router = Router()
4243// Get services from container
4344const obpClientService = Container . get ( OBPClientService )
4445const oauth2Service = Container . get ( OAuth2Service )
46+ const providerManager = Container . get ( OAuth2ProviderManager )
4547
46- const connectors = [ 'akka_vDec2018' , 'rest_vMar2019' , 'stored_procedure_vDec2019' , 'rabbitmq_vOct2024' ]
48+ const connectors = [
49+ 'akka_vDec2018' ,
50+ 'rest_vMar2019' ,
51+ 'stored_procedure_vDec2019' ,
52+ 'rabbitmq_vOct2024'
53+ ]
4754
4855/**
4956 * Helper function to check if response contains an error
@@ -225,4 +232,67 @@ router.get('/status/oauth2/reconnect', async (req: Request, res: Response) => {
225232 }
226233} )
227234
235+ /**
236+ * GET /status/providers
237+ * Get configured OAuth2 providers (for debugging)
238+ * Shows provider configuration with masked credentials
239+ */
240+ router . get ( '/status/providers' , ( req : Request , res : Response ) => {
241+ try {
242+ // Helper function to mask sensitive data (show first 3 and last 3 chars)
243+ const maskCredential = ( value : string | undefined ) : string => {
244+ if ( ! value || value . length < 8 ) {
245+ return value ? '***masked***' : 'not configured'
246+ }
247+ return `${ value . substring ( 0 , 3 ) } ...${ value . substring ( value . length - 3 ) } `
248+ }
249+
250+ // Get providers from manager
251+ const availableProviders = providerManager . getAvailableProviders ( )
252+ const allProviderStatus = providerManager . getAllProviderStatus ( )
253+
254+ // Get env configuration (masked)
255+ const envConfig = {
256+ obpOidc : {
257+ clientId : maskCredential ( process . env . VITE_OBP_OAUTH2_CLIENT_ID ) ,
258+ wellKnownUrl : process . env . VITE_OBP_OAUTH2_WELL_KNOWN_URL || 'not configured' ,
259+ redirectUrl : process . env . VITE_OBP_OAUTH2_REDIRECT_URL || 'not configured'
260+ } ,
261+ keycloak : {
262+ clientId : maskCredential ( process . env . VITE_KEYCLOAK_CLIENT_ID ) ,
263+ redirectUrl : process . env . VITE_KEYCLOAK_REDIRECT_URL || 'not configured'
264+ } ,
265+ google : {
266+ clientId : maskCredential ( process . env . VITE_GOOGLE_CLIENT_ID ) ,
267+ redirectUrl : process . env . VITE_GOOGLE_REDIRECT_URL || 'not configured'
268+ } ,
269+ github : {
270+ clientId : maskCredential ( process . env . VITE_GITHUB_CLIENT_ID ) ,
271+ redirectUrl : process . env . VITE_GITHUB_REDIRECT_URL || 'not configured'
272+ } ,
273+ custom : {
274+ providerName : process . env . VITE_CUSTOM_OIDC_PROVIDER_NAME || 'not configured' ,
275+ clientId : maskCredential ( process . env . VITE_CUSTOM_OIDC_CLIENT_ID ) ,
276+ redirectUrl : process . env . VITE_CUSTOM_OIDC_REDIRECT_URL || 'not configured'
277+ }
278+ }
279+
280+ res . json ( {
281+ summary : {
282+ totalConfigured : availableProviders . length ,
283+ availableProviders : availableProviders ,
284+ obpApiHost : process . env . VITE_OBP_API_HOST || 'not configured'
285+ } ,
286+ providerStatus : allProviderStatus ,
287+ environmentConfig : envConfig ,
288+ note : 'Credentials are masked for security. Format: first3...last3'
289+ } )
290+ } catch ( error ) {
291+ console . error ( 'Status: Error getting provider status:' , error )
292+ res . status ( 500 ) . json ( {
293+ error : error instanceof Error ? error . message : 'Unknown error'
294+ } )
295+ }
296+ } )
297+
228298export default router
0 commit comments