oidc: reload the login form if the interaction expires
use the error status which the oidc provider module returns
This commit is contained in:
+6
-6
@@ -320,8 +320,11 @@ async function renderError(error) {
|
||||
return html;
|
||||
}
|
||||
|
||||
async function renderInteractionPage(req, res) {
|
||||
const { uid, prompt, params, session } = await gOidcProvider.interactionDetails(req, res);
|
||||
async function renderInteractionPage(req, res, next) {
|
||||
const [detailsError, details] = await safe(gOidcProvider.interactionDetails(req, res));
|
||||
if (detailsError) return next(new HttpError(detailsError.statusCode, detailsError.error_description));
|
||||
|
||||
const { uid, prompt, params, session } = details;
|
||||
|
||||
const client = await oidcClients.get(params.client_id);
|
||||
if (!client) return res.send(await renderError(new Error('Client not found')));
|
||||
@@ -384,10 +387,7 @@ async function renderInteractionPage(req, res) {
|
||||
|
||||
async function interactionLogin(req, res, next) {
|
||||
const [detailsError, details] = await safe(gOidcProvider.interactionDetails(req, res));
|
||||
if (detailsError) {
|
||||
if (detailsError.error_description === 'interaction session not found') return next(new HttpError(410, 'session timeout'));
|
||||
return next(new HttpError(400, detailsError));
|
||||
}
|
||||
if (detailsError) return next(new HttpError(detailsError.statusCode, detailsError.error_description));
|
||||
|
||||
const ip = req.headers['x-forwarded-for'] || req.socket.remoteAddress || null;
|
||||
const clientId = details.params.client_id;
|
||||
|
||||
Reference in New Issue
Block a user