-
Notifications
You must be signed in to change notification settings - Fork 3
Multiple Provider Scenario (1+ providers) #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit e1b4c3c
if (!!routeId && needsAuthorization(routeId)) { | ||
logger.debug('Checking authorization for user route:', event.url.pathname); | ||
if (!oauth2ProviderManager.isReady()) { | ||
logger.warn('OAuth2 providers not ready:', oauth2ProviderManager.getStatus().error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the bubble up of the error from the provider manager here
email: string; | ||
username: string; | ||
entitlements: { | ||
entitlements: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Various unnecessary formatting changes, can leave them in this time I guess
} | ||
|
||
// Always return a response, even when there's no session | ||
return await resolve(event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a formatting change
const existingProvider = this.status.providers.find((p) => p.provider === definedProvider); | ||
if (existingProvider) { | ||
existingProvider.status = 'unavailable'; | ||
existingProvider.error = 'Provider not configured in OBP API well-known endpoints'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it would be good to have a log message for all providers that we have strategies for in the portal but aren,t in the well-known endpoints. Like a log.warn. Could help debugging
} catch (error: any) { | ||
logger.error('Opey Auth error:', error); | ||
return json({ error: error.message || 'Internal Server Error' }, { status: 500 }); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only formatting changes here, ignore
return json( | ||
{ success: true, authenticated: true }, | ||
setCookieHeaders ? { headers: { 'Set-Cookie': setCookieHeaders } } : {} | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting changes only
{/if} | ||
</div> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
logger.error(`Error during ${provider} OAuth login:`, err); | ||
throw error(500, 'Internal Server Error'); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice use of [blobs]
|
||
// Redirect to the generic provider route for backward compatibility | ||
logger.debug(`Redirecting to generic provider route: /login/${provider}`); | ||
throw redirect(302, `/login/${provider}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is kept for backwards compatibility? But we may not really need it
logger.error('Invalid user data received from OBP - missing user_id or email'); | ||
throw error(400, 'Authentication failed - invalid user data'); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, not sure if it is actually nessecary to keep this at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, we don't need to undo the formatting changes necessarily, but good to keep them out for next time with an ai.md or similar.
I was wondering because I think there are some tests configured for the oauth stuff already in the portal. Maybe we need to write new tests now...
No description provided.