Skip to content

Conversation

constantine2nd
Copy link
Contributor

No description provided.

@constantine2nd constantine2nd changed the title Few tweaks Portal -> Keycloak Oct 14, 2025
@constantine2nd constantine2nd changed the title Portal -> Keycloak Multiple Provider Scenario (1+ providers) Oct 15, 2025
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);
Copy link
Collaborator

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: {
Copy link
Collaborator

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);
Copy link
Collaborator

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';
Copy link
Collaborator

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 });
}
Copy link
Collaborator

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 } } : {}
);
Copy link
Collaborator

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>
Copy link
Collaborator

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');
}
}
Copy link
Collaborator

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}`);
Copy link
Collaborator

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');
}
}
Copy link
Collaborator

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

Copy link
Collaborator

@nemozak1 nemozak1 left a 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...

@simonredfern simonredfern merged commit 1605b45 into OpenBankProject:main Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants