- Step-by-step testing scenarios - Prerequisites and setup instructions - Expected outputs and pass criteria - Troubleshooting section - Performance and security testing guidelines - Test report template - 15 detailed test scenarios covering all functionality
18 KiB
Multi-OIDC Provider Testing Guide
Branch: multi-login
Date: 2024
Status: Ready for Testing
Overview
This guide provides step-by-step instructions for testing the multi-OIDC provider login implementation in API Explorer II.
Prerequisites
1. OBP API Setup
Ensure your OBP API is running and configured to return well-known URIs:
# Test the endpoint
curl http://localhost:8080/obp/v5.1.0/well-known
# Expected response:
{
"well_known_uris": [
{
"provider": "obp-oidc",
"url": "http://127.0.0.1:9000/obp-oidc/.well-known/openid-configuration"
},
{
"provider": "keycloak",
"url": "http://127.0.0.1:8180/realms/obp/.well-known/openid-configuration"
}
]
}
2. OIDC Providers Running
Ensure at least one OIDC provider is running:
OBP-OIDC:
# Check if OBP-OIDC is running
curl http://127.0.0.1:9000/obp-oidc/.well-known/openid-configuration
Keycloak (optional):
# Check if Keycloak is running
curl http://127.0.0.1:8180/realms/obp/.well-known/openid-configuration
3. Environment Configuration
Set up your .env file with provider credentials:
# OBP API
VITE_OBP_API_HOST=localhost:8080
# OBP-OIDC Provider
VITE_OBP_OAUTH2_CLIENT_ID=48ac28e9-9ee3-47fd-8448-69a62764b779
VITE_OBP_OAUTH2_CLIENT_SECRET=fOTQF7jfg8C74u7ZhSjVQpoBYvD0KpWfM5UsEZBSFFM
VITE_OBP_OAUTH2_REDIRECT_URL=http://localhost:5173/api/oauth2/callback
# Keycloak Provider (optional)
# VITE_KEYCLOAK_CLIENT_ID=obp-api-explorer
# VITE_KEYCLOAK_CLIENT_SECRET=your-keycloak-secret
# VITE_KEYCLOAK_REDIRECT_URL=http://localhost:5173/api/oauth2/callback
# Session Secret
SESSION_SECRET=your-secure-session-secret
# Redis (if using)
# VITE_OBP_REDIS_URL=redis://localhost:6379
Starting the Application
1. Switch to Multi-Login Branch
git checkout multi-login
2. Install Dependencies (if needed)
npm install
3. Start the Backend
# Terminal 1
npm run dev:backend
Expected output:
--- OAuth2 Multi-Provider Setup ---------------------------------
OAuth2ProviderManager: Fetching well-known URIs from OBP API...
OAuth2ProviderManager: Found 2 providers:
- obp-oidc: http://127.0.0.1:9000/obp-oidc/.well-known/openid-configuration
- keycloak: http://127.0.0.1:8180/realms/obp/.well-known/openid-configuration
OAuth2ProviderManager: Initializing providers...
OAuth2ProviderFactory: Loading provider strategies...
✓ OBP-OIDC strategy loaded
✓ Keycloak strategy loaded
OAuth2ProviderFactory: Loaded 2 provider strategies
OAuth2ProviderFactory: Initializing provider: obp-oidc
OAuth2ClientWithConfig: Fetching OIDC config for obp-oidc from: http://127.0.0.1:9000/obp-oidc/.well-known/openid-configuration
OAuth2ClientWithConfig: OIDC config loaded for obp-oidc
OAuth2ProviderManager: ✓ obp-oidc initialized
OAuth2ProviderFactory: Initializing provider: keycloak
OAuth2ProviderManager: ✓ keycloak initialized
OAuth2ProviderManager: Initialized 2/2 providers
✓ Initialized 2 OAuth2 providers:
- obp-oidc
- keycloak
✓ Provider health monitoring started (every 60s)
-----------------------------------------------------------------
Backend is running. You can check a status at http://localhost:8085/api/status
4. Start the Frontend
# Terminal 2
npm run dev
5. Open Browser
Navigate to: http://localhost:5173
Test Scenarios
Test 1: Provider Discovery
Objective: Verify that providers are fetched from OBP API
Steps:
- Open browser developer console
- Navigate to http://localhost:5173
- Look for log messages in console
Expected Console Output:
Available OAuth2 providers: [
{ name: "obp-oidc", available: true, lastChecked: "..." },
{ name: "keycloak", available: true, lastChecked: "..." }
]
Total: 2, Available: 2
✅ Pass Criteria:
- Providers are logged in console
availableCountmatches number of running providers
Test 2: Backend API Endpoint
Objective: Test the /api/oauth2/providers endpoint
Steps:
- Open a new terminal
- Run:
curl http://localhost:5173/api/oauth2/providers
Expected Response:
{
"providers": [
{
"name": "obp-oidc",
"available": true,
"lastChecked": "2024-01-15T10:30:00.000Z"
},
{
"name": "keycloak",
"available": true,
"lastChecked": "2024-01-15T10:30:00.000Z"
}
],
"count": 2,
"availableCount": 2
}
✅ Pass Criteria:
- HTTP 200 status
- JSON response with providers array
- Each provider has
name,available,lastCheckedfields
Test 3: Login Button - Multiple Providers
Objective: Test provider selection dialog appears
Steps:
- Navigate to http://localhost:5173
- Ensure you're logged out
- Look at the "Login" button in the header
- Click the "Login" button
Expected Behavior:
- Login button shows a small down arrow (▼)
- Provider selection dialog appears
- Dialog shows all available providers (OBP-OIDC, Keycloak)
- Each provider shows icon, name, and "Available" status
✅ Pass Criteria:
- Dialog opens smoothly
- All available providers are listed
- Provider names are formatted nicely (e.g., "OBP OIDC", "Keycloak")
- Hover effect works (border turns blue, slight translate)
Test 4: Login with OBP-OIDC
Objective: Complete login flow with OBP-OIDC provider
Steps:
- Click "Login" button
- Select "OBP OIDC" from the dialog
- You should be redirected to OBP-OIDC login page
- Enter credentials (if prompted)
- After authentication, you should be redirected back
Expected URL Flow:
1. http://localhost:5173
2. Click login → Provider selection dialog
3. Select provider → http://localhost:5173/api/oauth2/connect?provider=obp-oidc&redirect=/
4. Server redirects → http://127.0.0.1:9000/obp-oidc/auth?client_id=...&state=...&code_challenge=...
5. After auth → http://localhost:5173/api/oauth2/callback?code=xxx&state=yyy
6. Final redirect → http://localhost:5173/
Expected Console Output (Backend):
OAuth2ConnectController: Starting authentication flow
Provider: obp-oidc
Redirect: /
OAuth2ConnectController: Multi-provider mode - obp-oidc
OAuth2ConnectController: Redirecting to obp-oidc authorization endpoint
OAuth2CallbackController: Processing OAuth2 callback
OAuth2CallbackController: Multi-provider mode - obp-oidc
OAuth2CallbackController: Exchanging authorization code for tokens
OAuth2ClientWithConfig: Exchanging authorization code for obp-oidc
OAuth2CallbackController: Tokens received and stored
OAuth2CallbackController: Fetching user info
OAuth2CallbackController: User authenticated via obp-oidc: username
OAuth2CallbackController: Authentication successful, redirecting to: /
✅ Pass Criteria:
- User is redirected to OBP-OIDC
- After authentication, user is redirected back
- Username appears in header (top right)
- Login button changes to username + logoff button
- Session persists (refresh page, still logged in)
Test 5: Login with Keycloak
Objective: Test login with different provider
Steps:
- Log out (if logged in)
- Click "Login" button
- Select "Keycloak" from the dialog
- Complete Keycloak authentication
- Verify successful login
Expected Behavior:
- Same as Test 4, but with Keycloak provider
- Session should store
oauth2_provider: "keycloak"
✅ Pass Criteria:
- Login succeeds with Keycloak
- Username displayed in header
- Session persists
Test 6: Single Provider Mode
Objective: Test fallback when only one provider is available
Steps:
- Stop Keycloak (or configure only OBP-OIDC)
- Restart backend
- Log out
- Click "Login" button
Expected Behavior:
- No provider selection dialog
- Direct redirect to OBP-OIDC (the only available provider)
✅ Pass Criteria:
- No dialog appears
- Immediate redirect to single provider
Test 7: No Providers Available
Objective: Test error handling when no providers are available
Steps:
- Stop all OIDC providers (OBP-OIDC, Keycloak)
- Restart backend
- Wait 60 seconds for health check
- Refresh frontend
- Click "Login" button
Expected Behavior:
- Login button might be disabled or show error
- Dialog shows "No identity providers available"
✅ Pass Criteria:
- Graceful error handling
- User-friendly error message
Test 8: Provider Health Monitoring
Objective: Test real-time health monitoring
Steps:
- Start with all providers running
- Log in successfully
- Stop OBP-OIDC (but keep backend running)
- Wait 60 seconds (health check interval)
- Check backend console
Expected Console Output:
OAuth2ProviderManager: Performing health check...
obp-oidc: ✗ unhealthy (Connection refused)
keycloak: ✓ healthy
Test frontend: 6. Log out 7. Click "Login" button 8. Verify only Keycloak appears in provider list
✅ Pass Criteria:
- Health check detects provider outage
- Unhealthy providers removed from selection
- Backend logs show health status
Test 9: Session Persistence
Objective: Verify session data is stored correctly
Steps:
- Log in with OBP-OIDC
- Open browser developer tools
- Go to Application → Cookies → localhost:5173
- Find session cookie
Expected Session Data (Backend):
session = {
oauth2_provider: "obp-oidc",
oauth2_access_token: "...",
oauth2_refresh_token: "...",
oauth2_id_token: "...",
user: {
username: "john.doe",
email: "john@example.com",
name: "John Doe",
provider: "obp-oidc",
sub: "uuid-1234"
}
}
✅ Pass Criteria:
- Session cookie exists
- Session contains provider name
- Session contains tokens and user info
Test 10: API Requests with Token
Objective: Verify access token is used for API requests
Steps:
- Log in successfully
- Navigate to API Explorer (resource docs)
- Try to make an API request (e.g., GET /banks)
- Check network tab in developer tools
Expected Behavior:
- API request includes
Authorization: Bearer <token>header - Request succeeds (200 OK)
✅ Pass Criteria:
- Authorization header present
- Token matches session token
- API request succeeds
Test 11: Logout Flow
Objective: Test logout clears session
Steps:
- Log in successfully
- Click "Logoff" button in header
- Verify redirect to home page
- Check that username is no longer displayed
- Verify session is cleared
✅ Pass Criteria:
- Redirect to home page
- Login button reappears
- Username disappears
- Session cleared (check cookies)
Test 12: Redirect After Login
Objective: Test redirect to original page after login
Steps:
- Navigate to http://localhost:5173/resource-docs/OBPv5.1.0
- Ensure logged out
- Click "Login" button
- Select provider and authenticate
- Verify redirect back to
/resource-docs/OBPv5.1.0
Expected URL:
After login: http://localhost:5173/resource-docs/OBPv5.1.0
✅ Pass Criteria:
- User redirected to original page
- Page state preserved
Test 13: Error Handling - Invalid Provider
Objective: Test error handling for invalid provider
Steps:
- Manually navigate to: http://localhost:5173/api/oauth2/connect?provider=invalid-provider
- Check response
Expected Response:
{
"error": "invalid_provider",
"message": "Provider \"invalid-provider\" is not available",
"availableProviders": ["obp-oidc", "keycloak"]
}
✅ Pass Criteria:
- HTTP 400 status
- Error message displayed
- Available providers listed
Test 14: CSRF Protection (State Validation)
Objective: Test state parameter validation
Steps:
- Start login flow
- Capture callback URL
- Modify
stateparameter in URL - Try to complete callback
Expected Behavior:
- Callback rejected
- Redirect to home with error:
?oauth2_error=invalid_state
✅ Pass Criteria:
- Invalid state rejected
- User not authenticated
- Error logged in console
Test 15: Backward Compatibility
Objective: Test legacy single-provider mode still works
Steps:
- Remove all provider environment variables except
VITE_OBP_OAUTH2_WELL_KNOWN_URL - Set
VITE_OBP_OAUTH2_WELL_KNOWN_URL=http://127.0.0.1:9000/obp-oidc/.well-known/openid-configuration - Restart backend
- Try to log in
Expected Behavior:
- Falls back to legacy OAuth2Service
- Login works without provider parameter
✅ Pass Criteria:
- Login succeeds
- No provider selection dialog
- Direct redirect to OIDC provider
Troubleshooting
Issue: No providers available
Symptoms:
- Provider list is empty
- Login button disabled or shows error
Checks:
- Verify OBP API is running:
curl http://localhost:8080/obp/v5.1.0/well-known - Check backend logs for initialization errors
- Verify environment variables are set correctly
- Check OIDC providers are running and accessible
Solution:
# Check OBP API
curl http://localhost:8080/obp/v5.1.0/well-known
# Check OBP-OIDC
curl http://127.0.0.1:9000/obp-oidc/.well-known/openid-configuration
# Restart backend with verbose logging
npm run dev:backend
Issue: State mismatch error
Symptoms:
- Redirect to home with
?oauth2_error=invalid_state - Console shows "State mismatch (CSRF protection)"
Causes:
- Session not persisting between requests
- Redis not running (if using Redis sessions)
- Multiple backend instances
Solution:
# If using Redis, ensure it's running
redis-cli ping
# Check session secret is set
echo $SESSION_SECRET
# Clear browser cookies and try again
Issue: Token exchange failed
Symptoms:
- Error after authentication: "token_exchange_failed"
- Backend logs show 401 or 400 errors
Causes:
- Wrong client ID or secret
- OIDC provider configuration mismatch
- Network connectivity issues
Solution:
# Verify client credentials in OIDC provider
# Check backend logs for detailed error
# Verify redirect URI matches exactly
Issue: Provider shows as unavailable
Symptoms:
- Provider appears in list but marked as unavailable
- Red status indicator
Causes:
- OIDC provider is down
- Network connectivity issues
- Health check failed
Solution:
# Check provider is running
curl http://127.0.0.1:9000/obp-oidc/.well-known/openid-configuration
# Check backend logs for health check errors
# Wait 60 seconds for next health check
# Manually retry provider
# POST /api/oauth2/providers/{name}/retry (if implemented)
Performance Testing
Load Testing Login Flow
Test with multiple concurrent users:
# Install Apache Bench
sudo apt-get install apache2-utils
# Test provider list endpoint
ab -n 100 -c 10 http://localhost:5173/api/oauth2/providers
# Expected: < 100ms response time
Health Check Performance
Monitor health check impact:
# Watch backend logs during health checks
tail -f backend.log | grep "health check"
# Expected: Health checks complete in < 5 seconds
Security Testing
Test PKCE Implementation
Verify PKCE code challenge:
- Start login flow
- Capture authorization URL
- Verify
code_challengeandcode_challenge_method=S256present
Test State Validation
Verify CSRF protection:
- Capture callback URL with state
- Modify state parameter
- Verify callback is rejected
Test Token Security
Verify tokens are not exposed:
- Check tokens are not in URL parameters
- Check tokens are not logged in console
- Check tokens are in httpOnly cookies or session only
Acceptance Criteria
Backend
- Multiple providers fetched from OBP API
- Health monitoring active (60s intervals)
- Provider status tracked correctly
- Login works with multiple providers
- Session stores provider name
- Token exchange succeeds
- User info fetched correctly
- Backward compatible with legacy mode
Frontend
- Provider list fetched and displayed
- Provider selection dialog appears
- Single provider direct login
- Provider icons and names formatted
- Hover effects work
- Error handling graceful
- Loading states handled
Integration
- End-to-end login flow tested
- Multiple providers tested (OBP-OIDC, Keycloak)
- Session persistence verified
- API requests with token verified
- Logout flow tested
- Redirect after login tested
- Error scenarios handled
Test Report Template
# Multi-OIDC Provider Test Report
**Date:** YYYY-MM-DD
**Tester:** Name
**Branch:** multi-login
**Commit:** abc1234
## Environment
- OBP API: Running / Not Running
- OBP-OIDC: Running / Not Running
- Keycloak: Running / Not Running
- Backend: Version
- Frontend: Version
## Test Results
### Test 1: Provider Discovery
Status: ✅ Pass / ❌ Fail
Notes: ...
### Test 2: Backend API Endpoint
Status: ✅ Pass / ❌ Fail
Notes: ...
[Continue for all tests...]
## Issues Found
1. Issue description
- Severity: High / Medium / Low
- Steps to reproduce
- Expected behavior
- Actual behavior
## Overall Assessment
✅ Ready for Production
⚠️ Ready with Minor Issues
❌ Not Ready
## Recommendations
- ...
Next Steps
After completing all tests:
- Document Issues: Create GitHub issues for any bugs found
- Update Documentation: Update README.md with multi-provider setup
- Create PR: Create pull request to merge
multi-loginintodevelop - Review: Request code review from team
- Deploy: Plan deployment to staging/production
Support
If you encounter issues during testing:
- Check backend logs:
npm run dev:backend - Check browser console for errors
- Review this guide's troubleshooting section
- Check implementation documentation:
MULTI-OIDC-PROVIDER-IMPLEMENTATION.md - Contact the development team
Last Updated: 2024
Version: 1.0