@adonis-agora/payments 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/providers/dashboard_provider.d.ts +12 -3
- package/dist/providers/dashboard_provider.d.ts.map +1 -1
- package/dist/providers/dashboard_provider.js +95 -12
- package/dist/providers/dashboard_provider.js.map +1 -1
- package/dist/src/dashboard/access_denied_page.d.ts +102 -0
- package/dist/src/dashboard/access_denied_page.d.ts.map +1 -0
- package/dist/src/dashboard/access_denied_page.js +266 -0
- package/dist/src/dashboard/access_denied_page.js.map +1 -0
- package/dist/src/dashboard/define_config.d.ts +26 -0
- package/dist/src/dashboard/define_config.d.ts.map +1 -1
- package/dist/src/dashboard/define_config.js +1 -0
- package/dist/src/dashboard/define_config.js.map +1 -1
- package/dist/src/dashboard/index.d.ts +3 -1
- package/dist/src/dashboard/index.d.ts.map +1 -1
- package/dist/src/dashboard/index.js +2 -0
- package/dist/src/dashboard/index.js.map +1 -1
- package/dist/src/dashboard/login_page.d.ts +22 -9
- package/dist/src/dashboard/login_page.d.ts.map +1 -1
- package/dist/src/dashboard/login_page.js +29 -41
- package/dist/src/dashboard/login_page.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @adonis-agora/payments
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#18](https://github.com/DavideCarvalho/adonis-agora-payments/pull/18) [`7513756`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/7513756cc6e85cf2b7763737da27bb7599d03878) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Dashboard: a refused page navigation now gets a real page instead of `{"error":"forbidden"}`.
|
|
8
|
+
|
|
9
|
+
Opening the console without permission used to answer the browser with the same JSON the API
|
|
10
|
+
gets. It now serves a built-in access-denied page in the console's own visual language — the
|
|
11
|
+
status, a sentence explaining the refusal, a "Back to app" link and, when `dashboardAuth.login`
|
|
12
|
+
is configured, a "Sign in" button. The Mode-A-only "Open this console from your application."
|
|
13
|
+
notice uses the same page. API requests are unchanged (the SPA still relies on their JSON), and
|
|
14
|
+
an `authorize` hook that redirects still wins.
|
|
15
|
+
|
|
16
|
+
The page carries no inline `<script>`, so a nonce'd `script-src` CSP cannot break it; its inline
|
|
17
|
+
`<style>` takes `@adonisjs/shield`'s request nonce when one exists.
|
|
18
|
+
|
|
19
|
+
New `accessDenied` option on `config/payments_dashboard.ts` to customise it — an object
|
|
20
|
+
(`brand`, `title`, `message`, `homeHref`, `loginHref`, `accent`, labels) to tweak the built-in
|
|
21
|
+
page, or a function `(info, ctx) => html | void` to render it yourself or redirect.
|
|
22
|
+
|
|
23
|
+
Also: the built-in `dashboardAuth` login page no longer dies under a nonce'd CSP. It is now a real
|
|
24
|
+
HTML form that works without JavaScript — a form submit is answered with a redirect (to the page
|
|
25
|
+
the operator came from, or back to the form with the error shown) while the page's own `fetch`
|
|
26
|
+
keeps getting JSON — and its inline script/style carry `@adonisjs/shield`'s request nonce.
|
|
27
|
+
`renderLoginPage` takes an optional `{ nonce, error, returnTo }`.
|
|
28
|
+
|
|
3
29
|
## 0.4.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -79,10 +79,12 @@ export default class PaymentsDashboardProvider {
|
|
|
79
79
|
* Run the guards for a dashboard resource. Composes the `authorize` hook (bearer token/custom)
|
|
80
80
|
* with the optional `dashboardAuth` session guard — BOTH must pass:
|
|
81
81
|
*
|
|
82
|
-
* 1. `authorize` fails -> `403
|
|
82
|
+
* 1. `authorize` fails -> `403`: the built-in (or host-customised) access-denied PAGE for a
|
|
83
|
+
* `page` request, `{ error: 'forbidden' }` JSON for an `api` request.
|
|
83
84
|
* 2. `dashboardAuth` configured AND no valid session -> for a `page` request, redirect `302` to
|
|
84
|
-
* the login page (Mode B) carrying a sanitized `returnTo`, or
|
|
85
|
-
* for an `api` request,
|
|
85
|
+
* the login page (Mode B) carrying a sanitized `returnTo`, or the `401` "open this console
|
|
86
|
+
* from your app" page (Mode A only); for an `api` request,
|
|
87
|
+
* `401 { error: 'unauthorized', auth: { modes } }`.
|
|
86
88
|
*
|
|
87
89
|
* Returns `allowed: false` (and has already written the response) when the request must
|
|
88
90
|
* short-circuit. On success it also carries WHO passed the gate: the session's user, which
|
|
@@ -91,6 +93,13 @@ export default class PaymentsDashboardProvider {
|
|
|
91
93
|
* one would be worse than an honest "unattributed".
|
|
92
94
|
*/
|
|
93
95
|
private enforce;
|
|
96
|
+
/**
|
|
97
|
+
* Answer a refused PAGE navigation with HTML instead of the API's JSON: the built-in page, the
|
|
98
|
+
* host's tweaked version of it, or whatever the host's `accessDenied` renderer produced. Stands
|
|
99
|
+
* down when the request is already answered — an `authorize` hook (or the renderer) that wrote a
|
|
100
|
+
* redirect keeps it; the provider never overwrites a `location` header.
|
|
101
|
+
*/
|
|
102
|
+
private denyPage;
|
|
94
103
|
private readSessionCookie;
|
|
95
104
|
private writeSessionCookie;
|
|
96
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard_provider.d.ts","sourceRoot":"","sources":["../../providers/dashboard_provider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAqB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"dashboard_provider.d.ts","sourceRoot":"","sources":["../../providers/dashboard_provider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAqB,MAAM,sBAAsB,CAAC;AAsElF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,OAAO,OAAO,yBAAyB;IAChC,SAAS,CAAC,GAAG,EAAE,kBAAkB;IAA7C,YAAsB,GAAG,EAAE,kBAAkB,EAAI;IAEjD,oGAAoG;IACpG,OAAO,CAAC,iBAAiB,CAAS;IAE5B,IAAI,kBAaT;IAED,OAAO,CAAC,cAAc;IA2FtB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,YAAY,CAAwC;YAE9C,OAAO;IAqCrB;iGAC6F;YAC/E,eAAe;YAef,gBAAgB;IAa9B,yEAAyE;IACzE,OAAO,CAAC,iBAAiB;IAwDzB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,kBAAkB;YAoFZ,aAAa;IAQ3B;;;;;;;;;;;;;;;;OAgBG;YACW,OAAO;IA2CrB;;;;;OAKG;YACW,QAAQ;IAuBtB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,kBAAkB;CAU3B"}
|
|
@@ -2,8 +2,9 @@ import { readFile } from 'node:fs/promises';
|
|
|
2
2
|
import { basename, resolve as resolvePath } from 'node:path';
|
|
3
3
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
4
|
import { WebhookProcessor } from '../src/billing/webhook_processor.js';
|
|
5
|
+
import { resolveAccessDeniedPage, } from '../src/dashboard/access_denied_page.js';
|
|
5
6
|
import { createRefundAction, createReplayAction } from '../src/dashboard/actions.js';
|
|
6
|
-
import { performLogin, performSession, readSession, SESSION_COOKIE_NAME, } from '../src/dashboard/auth.js';
|
|
7
|
+
import { performLogin, performSession, readSession, SESSION_COOKIE_NAME, sanitizeReturnTo, } from '../src/dashboard/auth.js';
|
|
7
8
|
import { resolveConfig, } from '../src/dashboard/define_config.js';
|
|
8
9
|
import { auditEvents, customers, disputes, health, overview, paymentDetail, payments, providers, refundPayment, resolveDispute, retryWebhookEvent, subscriptions, webhookEvents, } from '../src/dashboard/handlers.js';
|
|
9
10
|
import { renderLoginPage } from '../src/dashboard/login_page.js';
|
|
@@ -305,20 +306,45 @@ export default class PaymentsDashboardProvider {
|
|
|
305
306
|
.get(loginPath, async (ctx) => {
|
|
306
307
|
ctx.response.header('content-type', 'text/html; charset=utf-8');
|
|
307
308
|
ctx.response.header('cache-control', 'no-store, must-revalidate');
|
|
308
|
-
|
|
309
|
+
const qs = ctx.request.qs();
|
|
310
|
+
const nonce = cspNonce(ctx);
|
|
311
|
+
return ctx.response.send(renderLoginPage(config.path, {
|
|
312
|
+
...(nonce !== undefined ? { nonce } : {}),
|
|
313
|
+
error: qs.error !== undefined,
|
|
314
|
+
returnTo: qs.returnTo,
|
|
315
|
+
}));
|
|
309
316
|
})
|
|
310
317
|
.as('payments_dashboard.login.page');
|
|
318
|
+
// Two callers: the page's own `fetch` (JSON in, JSON out — `{ redirectTo }` / `{ error }`)
|
|
319
|
+
// and, with JavaScript off or its inline script dropped by a CSP, the same page as a classic
|
|
320
|
+
// form post (form-encoded in, a redirect out: to `returnTo` on success, back to the login
|
|
321
|
+
// page with `?error` on failure). Same hook, same cookie, same uniform failure either way.
|
|
311
322
|
router
|
|
312
323
|
.post(loginPath, async (ctx) => {
|
|
313
|
-
const
|
|
324
|
+
const body = ctx.request.body();
|
|
325
|
+
const outcome = await performLogin(auth, body, config.path);
|
|
326
|
+
const form = isFormPost(ctx);
|
|
327
|
+
const backToLogin = () => ctx.response
|
|
328
|
+
.redirect()
|
|
329
|
+
.withQs({
|
|
330
|
+
error: '1',
|
|
331
|
+
returnTo: sanitizeReturnTo(body?.returnTo, config.path || '/'),
|
|
332
|
+
})
|
|
333
|
+
.toPath(loginPath);
|
|
314
334
|
if (outcome.kind === 'bad-request') {
|
|
335
|
+
if (form)
|
|
336
|
+
return backToLogin();
|
|
315
337
|
return ctx.response.status(400).json({ error: outcome.message });
|
|
316
338
|
}
|
|
317
339
|
if (outcome.kind === 'unauthorized') {
|
|
318
340
|
await this.warnHookThrow(outcome.hookError);
|
|
341
|
+
if (form)
|
|
342
|
+
return backToLogin();
|
|
319
343
|
return ctx.response.status(401).json({ error: outcome.message });
|
|
320
344
|
}
|
|
321
345
|
this.writeSessionCookie(ctx, auth, outcome.cookieValue);
|
|
346
|
+
if (form)
|
|
347
|
+
return ctx.response.redirect().toPath(outcome.redirectTo);
|
|
322
348
|
return ctx.response.status(200).json({ redirectTo: outcome.redirectTo });
|
|
323
349
|
})
|
|
324
350
|
.as('payments_dashboard.login.submit');
|
|
@@ -355,10 +381,12 @@ export default class PaymentsDashboardProvider {
|
|
|
355
381
|
* Run the guards for a dashboard resource. Composes the `authorize` hook (bearer token/custom)
|
|
356
382
|
* with the optional `dashboardAuth` session guard — BOTH must pass:
|
|
357
383
|
*
|
|
358
|
-
* 1. `authorize` fails -> `403
|
|
384
|
+
* 1. `authorize` fails -> `403`: the built-in (or host-customised) access-denied PAGE for a
|
|
385
|
+
* `page` request, `{ error: 'forbidden' }` JSON for an `api` request.
|
|
359
386
|
* 2. `dashboardAuth` configured AND no valid session -> for a `page` request, redirect `302` to
|
|
360
|
-
* the login page (Mode B) carrying a sanitized `returnTo`, or
|
|
361
|
-
* for an `api` request,
|
|
387
|
+
* the login page (Mode B) carrying a sanitized `returnTo`, or the `401` "open this console
|
|
388
|
+
* from your app" page (Mode A only); for an `api` request,
|
|
389
|
+
* `401 { error: 'unauthorized', auth: { modes } }`.
|
|
362
390
|
*
|
|
363
391
|
* Returns `allowed: false` (and has already written the response) when the request must
|
|
364
392
|
* short-circuit. On success it also carries WHO passed the gate: the session's user, which
|
|
@@ -369,7 +397,10 @@ export default class PaymentsDashboardProvider {
|
|
|
369
397
|
async enforce(config, ctx, mode) {
|
|
370
398
|
const allowed = await config.authorize(ctx);
|
|
371
399
|
if (!allowed) {
|
|
372
|
-
if (
|
|
400
|
+
if (mode === 'page') {
|
|
401
|
+
await this.denyPage(ctx, config, { status: 403, reason: 'forbidden' });
|
|
402
|
+
}
|
|
403
|
+
else if (!ctx.response.getHeader('location')) {
|
|
373
404
|
ctx.response.status(403).json({ error: 'forbidden' });
|
|
374
405
|
}
|
|
375
406
|
return { allowed: false };
|
|
@@ -394,16 +425,38 @@ export default class PaymentsDashboardProvider {
|
|
|
394
425
|
}
|
|
395
426
|
// Mode A only: there's no login page to send the browser to — this deployment expects the
|
|
396
427
|
// host app to mint a session via `POST <path>/session` before ever navigating here.
|
|
397
|
-
ctx
|
|
398
|
-
.status(401)
|
|
399
|
-
.header('content-type', 'text/html; charset=utf-8')
|
|
400
|
-
.header('cache-control', 'no-store, must-revalidate')
|
|
401
|
-
.send('<!doctype html><html><body style="font-family:ui-monospace,monospace;background:#09090b;color:#e7e7ea;display:flex;align-items:center;justify-content:center;height:100vh;margin:0"><p>Open this console from your application.</p></body></html>');
|
|
428
|
+
await this.denyPage(ctx, config, { status: 401, reason: 'session-required' });
|
|
402
429
|
return { allowed: false };
|
|
403
430
|
}
|
|
404
431
|
ctx.response.status(401).json({ error: 'unauthorized', auth: { modes: auth.modes } });
|
|
405
432
|
return { allowed: false };
|
|
406
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Answer a refused PAGE navigation with HTML instead of the API's JSON: the built-in page, the
|
|
436
|
+
* host's tweaked version of it, or whatever the host's `accessDenied` renderer produced. Stands
|
|
437
|
+
* down when the request is already answered — an `authorize` hook (or the renderer) that wrote a
|
|
438
|
+
* redirect keeps it; the provider never overwrites a `location` header.
|
|
439
|
+
*/
|
|
440
|
+
async denyPage(ctx, config, denial) {
|
|
441
|
+
const answered = () => responseAnswered(ctx);
|
|
442
|
+
if (answered())
|
|
443
|
+
return;
|
|
444
|
+
const nonce = cspNonce(ctx);
|
|
445
|
+
const info = {
|
|
446
|
+
...denial,
|
|
447
|
+
basePath: config.path,
|
|
448
|
+
...(config.dashboardAuth?.login ? { loginHref: `${config.path}/login` } : {}),
|
|
449
|
+
...(nonce !== undefined ? { nonce } : {}),
|
|
450
|
+
};
|
|
451
|
+
const html = await resolveAccessDeniedPage(info, config.accessDenied, ctx, answered);
|
|
452
|
+
if (html === null)
|
|
453
|
+
return;
|
|
454
|
+
ctx.response
|
|
455
|
+
.status(info.status)
|
|
456
|
+
.header('content-type', 'text/html; charset=utf-8')
|
|
457
|
+
.header('cache-control', 'no-store, must-revalidate')
|
|
458
|
+
.send(html);
|
|
459
|
+
}
|
|
407
460
|
readSessionCookie(ctx) {
|
|
408
461
|
const value = ctx.request.plainCookie(SESSION_COOKIE_NAME, undefined, false);
|
|
409
462
|
return typeof value === 'string' && value !== '' ? value : undefined;
|
|
@@ -419,6 +472,36 @@ export default class PaymentsDashboardProvider {
|
|
|
419
472
|
});
|
|
420
473
|
}
|
|
421
474
|
}
|
|
475
|
+
/**
|
|
476
|
+
* Whether something already answered this request: a redirect (`location` header — the signal the
|
|
477
|
+
* `authorize` contract has always honoured) or a body queued on the response. The body check reads
|
|
478
|
+
* AdonisJS's `response.hasLazyBody` structurally so a plain-object `ctx` double in a unit test
|
|
479
|
+
* (which has neither) still works.
|
|
480
|
+
*/
|
|
481
|
+
function responseAnswered(ctx) {
|
|
482
|
+
if (ctx.response.getHeader('location'))
|
|
483
|
+
return true;
|
|
484
|
+
const response = ctx.response;
|
|
485
|
+
return response.hasLazyBody === true || response.headersSent === true;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* The request's CSP nonce when the host runs `@adonisjs/shield` with `@nonce` in its policy (shield
|
|
489
|
+
* exposes it as `response.nonce`). Read structurally: this package neither depends on shield nor
|
|
490
|
+
* cares which middleware minted the nonce — only that the page's inline `<style>` carries it.
|
|
491
|
+
*/
|
|
492
|
+
function cspNonce(ctx) {
|
|
493
|
+
const nonce = ctx.response.nonce;
|
|
494
|
+
return typeof nonce === 'string' && nonce !== '' ? nonce : undefined;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Whether a login `POST` came from a classic HTML form submit (form-encoded — JavaScript off, or
|
|
498
|
+
* the page's inline script dropped by a CSP) rather than the page's own JSON `fetch`. Decides
|
|
499
|
+
* whether the reply is a redirect (a browser navigating) or JSON (a script awaiting it).
|
|
500
|
+
*/
|
|
501
|
+
function isFormPost(ctx) {
|
|
502
|
+
const type = ctx.request.header('content-type') ?? '';
|
|
503
|
+
return type.includes('application/x-www-form-urlencoded') || type.includes('multipart/form-data');
|
|
504
|
+
}
|
|
422
505
|
/** Adapt an AdonisJS `HttpContext` to the framework-light {@link ApiRequest}. */
|
|
423
506
|
function toApiRequest(ctx) {
|
|
424
507
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard_provider.js","sourceRoot":"","sources":["../../providers/dashboard_provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EACL,YAAY,EACZ,cAAc,EAEd,WAAW,EACX,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,aAAa,GACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAGL,WAAW,EACX,SAAS,EAGT,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,qBAAqB,GAEtB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;GASG;AACH,IAAI,MAA0B,CAAC;AAC/B,SAAS,YAAY;IACnB,MAAM,KAAK,aAAa,CAAC,IAAI,GAAG,CAAC,gBAAg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AAE,GAAG;YACT,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;YACrC,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;IACL,CAAC;CACF;AAED,iFAAiF;AACjF,SAAS,YAAY,CAAC,GAAgB;IACpC,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,MAA4C;QACxD,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,EAAmD;QACxE,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE;KACzB,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"dashboard_provider.js","sourceRoot":"","sources":["../../providers/dashboard_provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAEL,uBAAuB,GACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EACL,YAAY,EACZ,cAAc,EAEd,WAAW,EACX,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,aAAa,GACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAGL,WAAW,EACX,SAAS,EAGT,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,cAA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AK,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;YACrC,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,GAAgB;IACxC,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IACpD,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAuE,CAAC;IAC7F,OAAO,QAAQ,CAAC,WAAW,KAAK,IAAI,IAAI,QAAQ,CAAC,WAAW,KAAK,IAAI,CAAC;AACxE,CAAC;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAC,GAAgB;IAChC,MAAM,KAAK,GAAI,GAAG,CAAC,QAA2C,CAAC,KAAK,CAAC;IACrE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,GAAgB;IAClC,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IACtD,OAAO,IAAI,CAAC,QAAQ,CAAC,mCAAmC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AACpG,CAAC;AAED,iFAAiF;AACjF,SAAS,YAAY,CAAC,GAAgB;IACpC,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,MAA4C;QACxD,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,EAAmD;QACxE,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The built-in "access denied" page a BROWSER sees when the dashboard guard refuses a page
|
|
3
|
+
* navigation — the SPA shell, its assets, or (Mode A only) a session-less visit. Before this page
|
|
4
|
+
* existed the guard answered every denial with the JSON it answers the API with
|
|
5
|
+
* (`{ "error": "forbidden" }`), which is the right thing for the SPA's `fetch` calls and the wrong
|
|
6
|
+
* thing for a human staring at a browser tab.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately a small, dependency-free, hand-authored HTML page (like `login_page.ts`) — NOT part
|
|
9
|
+
* of the bundled SPA, so a denial never needs the SPA to load first. It carries NO `<script>` at all,
|
|
10
|
+
* so a host running a nonce'd `script-src` CSP (the `@adonisjs/shield` default) cannot break it; the
|
|
11
|
+
* one inline `<style>` takes the request's CSP nonce when the provider hands one over.
|
|
12
|
+
*
|
|
13
|
+
* Every string the host can supply ({@link AccessDeniedPageOptions}) is HTML-escaped on the way in.
|
|
14
|
+
* They are developer-controlled config values, not user input — but escaping them costs nothing and
|
|
15
|
+
* removes the one class of bug a "just interpolate it" template would invite.
|
|
16
|
+
*
|
|
17
|
+
* The visual language (Aviary neutrals, the console's own accent, mono eyebrow over a sans body)
|
|
18
|
+
* mirrors the payments SPA so the refusal reads as part of the same product, not a server default.
|
|
19
|
+
*
|
|
20
|
+
* Ported to `@adonis-agora/durable`, `@adonis-agora/media`, `@adonis-agora/agent` and
|
|
21
|
+
* `@adonis-agora/telescope` with only {@link CONSOLE} changed, so the Agora consoles share ONE
|
|
22
|
+
* refusal story rather than each inventing its own.
|
|
23
|
+
*/
|
|
24
|
+
/** Why the guard refused. Drives the default title/message and which buttons make sense. */
|
|
25
|
+
export type AccessDeniedReason =
|
|
26
|
+
/** Nobody is signed in (a `401`): offer the login page when one exists. */
|
|
27
|
+
'unauthenticated'
|
|
28
|
+
/** Somebody is signed in but `authorize` said no (a `403`). */
|
|
29
|
+
| 'forbidden'
|
|
30
|
+
/** `dashboardAuth` runs in Mode A only and there is no session — the host app must mint one. */
|
|
31
|
+
| 'session-required';
|
|
32
|
+
/** What the provider knows about the refusal — handed to a custom renderer and to the default page. */
|
|
33
|
+
export interface AccessDeniedInfo {
|
|
34
|
+
/** The HTTP status the page is served with. */
|
|
35
|
+
status: 401 | 403;
|
|
36
|
+
reason: AccessDeniedReason;
|
|
37
|
+
/** The console's mount path (`/payments`; `''` when mounted at the root). */
|
|
38
|
+
basePath: string;
|
|
39
|
+
/** The built-in login page, present only when `dashboardAuth.login` is configured. */
|
|
40
|
+
loginHref?: string;
|
|
41
|
+
/** A developer-facing detail (e.g. a thrown hook's message). Providers set it OUTSIDE production only. */
|
|
42
|
+
detail?: string;
|
|
43
|
+
/** The request's CSP nonce, applied to the inline `<style>` so a nonce'd `style-src` keeps the page styled. */
|
|
44
|
+
nonce?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Knobs for the built-in page — the `accessDenied` config option in its OBJECT form. Every field is
|
|
48
|
+
* optional; omit the option entirely for the defaults.
|
|
49
|
+
*/
|
|
50
|
+
export interface AccessDeniedPageOptions {
|
|
51
|
+
/** Console name in the eyebrow and `<title>`. Default: the console's own name (`Payments`). */
|
|
52
|
+
brand?: string;
|
|
53
|
+
/** Heading. Default depends on {@link AccessDeniedInfo.reason}. */
|
|
54
|
+
title?: string;
|
|
55
|
+
/** The sentence under the heading. Default depends on the reason. */
|
|
56
|
+
message?: string;
|
|
57
|
+
/** Where "Back to app" points. Default `/`; `false` hides the button. */
|
|
58
|
+
homeHref?: string | false;
|
|
59
|
+
/** Label of the "Back to app" button. */
|
|
60
|
+
homeLabel?: string;
|
|
61
|
+
/** Where "Sign in" points. Default: the built-in login page when one exists; `false` hides it. */
|
|
62
|
+
loginHref?: string | false;
|
|
63
|
+
/** Label of the "Sign in" button. */
|
|
64
|
+
loginLabel?: string;
|
|
65
|
+
/** Accent colour (any CSS colour). Default: the console's own accent. */
|
|
66
|
+
accent?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The `accessDenied` config option in its FUNCTION form: render the page yourself. Return an HTML
|
|
70
|
+
* string and the provider serves it (with the refusal's status, `text/html`, `no-store`). Return
|
|
71
|
+
* nothing after answering the request yourself — a redirect to your own login page, most commonly —
|
|
72
|
+
* and the provider stands down. Return nothing WITHOUT answering and the default page is served, so
|
|
73
|
+
* the hook is safe to use for side effects (logging) alone.
|
|
74
|
+
*
|
|
75
|
+
* `Ctx` is the host framework's HTTP context — the provider passes AdonisJS's `HttpContext` through
|
|
76
|
+
* untouched; it is generic here so this module stays framework-light and unit-testable.
|
|
77
|
+
*/
|
|
78
|
+
export type AccessDeniedRenderer<Ctx = unknown> = (info: AccessDeniedInfo, ctx: Ctx) => string | undefined | null | void | Promise<string | undefined | null | void>;
|
|
79
|
+
/** The `accessDenied` config option: tweak the built-in page, or replace it. */
|
|
80
|
+
export type AccessDeniedOption<Ctx = unknown> = AccessDeniedPageOptions | AccessDeniedRenderer<Ctx>;
|
|
81
|
+
/** This console's identity — the ONLY thing that differs between the Agora ports of this file. */
|
|
82
|
+
export declare const CONSOLE: {
|
|
83
|
+
readonly brand: 'Payments';
|
|
84
|
+
readonly accent: '#22d3ee';
|
|
85
|
+
readonly packageName: '@adonis-agora/payments';
|
|
86
|
+
};
|
|
87
|
+
/** Escape the five characters that matter inside HTML text and double-quoted attributes. */
|
|
88
|
+
export declare function escapeHtml(value: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* Render the built-in page. Pure: same `info` + `options` in, same HTML out — so it is trivially
|
|
91
|
+
* snapshot/regex testable and safe to call from anywhere (the provider, a test, a host that wants
|
|
92
|
+
* to embed the default page inside its own layout).
|
|
93
|
+
*/
|
|
94
|
+
export declare function renderAccessDeniedPage(info: AccessDeniedInfo, options?: AccessDeniedPageOptions): string;
|
|
95
|
+
/**
|
|
96
|
+
* Resolve WHAT to serve for a refusal, honouring the host's `accessDenied` option in either form.
|
|
97
|
+
* Returns the HTML to send, or `null` when a custom renderer already answered the request itself
|
|
98
|
+
* (`answered()` reports whether it did — the provider wires that to "a `location` header or a body
|
|
99
|
+
* is already set"). Framework-light: knows nothing about the HTTP context beyond passing it through.
|
|
100
|
+
*/
|
|
101
|
+
export declare function resolveAccessDeniedPage<Ctx>(info: AccessDeniedInfo, option: AccessDeniedOption<Ctx> | null | undefined, ctx: Ctx, answered: () => boolean): Promise<string | null>;
|
|
102
|
+
//# sourceMappingURL=access_denied_page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access_denied_page.d.ts","sourceRoot":"","sources":["../../../src/dashboard/access_denied_page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,4FAA4F;AAC5F,MAAM,MAAM,kBAAkB;AAC5B,2EAA2E;AACzE,iBAAiB;AACnB,+DAA+D;GAC7D,WAAW;AACb,gGAAgG;GAC9F,kBAAkB,CAAC;AAEvB,uGAAuG;AACvG,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAClB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,sFAAsF;IACtF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0GAA0G;IAC1G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+GAA+G;IAC/G,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,+FAA+F;IAC/F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC1B,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC3B,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,oBAAoB,CAAC,GAAG,GAAG,OAAO,IAAI,CAChD,IAAI,EAAE,gBAAgB,EACtB,GAAG,EAAE,GAAG,KAEL,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAElF,gFAAgF;AAChF,MAAM,MAAM,kBAAkB,CAAC,GAAG,GAAG,OAAO,IAAI,uBAAuB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;AAEpG,kGAAkG;AAClG,eAAO,MAAM,OAAO;aAClB,KAAK,EAAE,UAAU;aACjB,MAAM,EAAE,SAAS;aACjB,WAAW,EAAE,wBAAwB;CAC7B,CAAC;AAmBX,4FAA4F;AAC5F,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOhD;AAyBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,gBAAgB,EACtB,OAAO,GAAE,uBAA4B,GACpC,MAAM,CAqLR;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,GAAG,EAC/C,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,EAClD,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,MAAM,OAAO,GACtB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQxB"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The built-in "access denied" page a BROWSER sees when the dashboard guard refuses a page
|
|
3
|
+
* navigation — the SPA shell, its assets, or (Mode A only) a session-less visit. Before this page
|
|
4
|
+
* existed the guard answered every denial with the JSON it answers the API with
|
|
5
|
+
* (`{ "error": "forbidden" }`), which is the right thing for the SPA's `fetch` calls and the wrong
|
|
6
|
+
* thing for a human staring at a browser tab.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately a small, dependency-free, hand-authored HTML page (like `login_page.ts`) — NOT part
|
|
9
|
+
* of the bundled SPA, so a denial never needs the SPA to load first. It carries NO `<script>` at all,
|
|
10
|
+
* so a host running a nonce'd `script-src` CSP (the `@adonisjs/shield` default) cannot break it; the
|
|
11
|
+
* one inline `<style>` takes the request's CSP nonce when the provider hands one over.
|
|
12
|
+
*
|
|
13
|
+
* Every string the host can supply ({@link AccessDeniedPageOptions}) is HTML-escaped on the way in.
|
|
14
|
+
* They are developer-controlled config values, not user input — but escaping them costs nothing and
|
|
15
|
+
* removes the one class of bug a "just interpolate it" template would invite.
|
|
16
|
+
*
|
|
17
|
+
* The visual language (Aviary neutrals, the console's own accent, mono eyebrow over a sans body)
|
|
18
|
+
* mirrors the payments SPA so the refusal reads as part of the same product, not a server default.
|
|
19
|
+
*
|
|
20
|
+
* Ported to `@adonis-agora/durable`, `@adonis-agora/media`, `@adonis-agora/agent` and
|
|
21
|
+
* `@adonis-agora/telescope` with only {@link CONSOLE} changed, so the Agora consoles share ONE
|
|
22
|
+
* refusal story rather than each inventing its own.
|
|
23
|
+
*/
|
|
24
|
+
/** This console's identity — the ONLY thing that differs between the Agora ports of this file. */
|
|
25
|
+
export const CONSOLE = {
|
|
26
|
+
brand: 'Payments',
|
|
27
|
+
accent: '#22d3ee',
|
|
28
|
+
packageName: '@adonis-agora/payments',
|
|
29
|
+
};
|
|
30
|
+
const DEFAULT_COPY = {
|
|
31
|
+
unauthenticated: {
|
|
32
|
+
title: 'Sign in required',
|
|
33
|
+
message: 'You need to be signed in to open this console.',
|
|
34
|
+
},
|
|
35
|
+
forbidden: {
|
|
36
|
+
title: 'Access denied',
|
|
37
|
+
message: 'Your account is not allowed to open this console. If that looks wrong, ask an administrator to grant you access.',
|
|
38
|
+
},
|
|
39
|
+
'session-required': {
|
|
40
|
+
title: 'Open this console from your app',
|
|
41
|
+
message: 'This console only accepts a session minted by your application. Go back to the app and open the console from there.',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
/** Escape the five characters that matter inside HTML text and double-quoted attributes. */
|
|
45
|
+
export function escapeHtml(value) {
|
|
46
|
+
return value
|
|
47
|
+
.replaceAll('&', '&')
|
|
48
|
+
.replaceAll('<', '<')
|
|
49
|
+
.replaceAll('>', '>')
|
|
50
|
+
.replaceAll('"', '"')
|
|
51
|
+
.replaceAll("'", ''');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Accept only a same-origin, root-relative path for a button `href` — the same open-redirect rule
|
|
55
|
+
* `sanitizeReturnTo` applies to `returnTo`. A host-supplied absolute URL is still a developer's
|
|
56
|
+
* choice, so it is allowed; what is refused is anything that could smuggle a `javascript:` scheme.
|
|
57
|
+
*/
|
|
58
|
+
function safeHref(candidate) {
|
|
59
|
+
const trimmed = candidate.trim();
|
|
60
|
+
if (trimmed === '')
|
|
61
|
+
return null;
|
|
62
|
+
if (/^(https?:)?\/\//i.test(trimmed))
|
|
63
|
+
return trimmed;
|
|
64
|
+
if (trimmed.startsWith('/'))
|
|
65
|
+
return trimmed;
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
/** Only a plausible CSS colour token reaches the stylesheet; anything else falls back to the accent. */
|
|
69
|
+
function safeColor(candidate) {
|
|
70
|
+
return /^[#a-zA-Z0-9(),.%\s-]+$/.test(candidate) ? candidate : CONSOLE.accent;
|
|
71
|
+
}
|
|
72
|
+
const LOCK_ICON = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>';
|
|
73
|
+
const KEY_ICON = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="7.5" cy="15.5" r="4.5"/><path d="m21 2-9.6 9.6"/><path d="m15.5 7.5 3 3L22 7l-3-3"/></svg>';
|
|
74
|
+
/**
|
|
75
|
+
* Render the built-in page. Pure: same `info` + `options` in, same HTML out — so it is trivially
|
|
76
|
+
* snapshot/regex testable and safe to call from anywhere (the provider, a test, a host that wants
|
|
77
|
+
* to embed the default page inside its own layout).
|
|
78
|
+
*/
|
|
79
|
+
export function renderAccessDeniedPage(info, options = {}) {
|
|
80
|
+
const copy = DEFAULT_COPY[info.reason];
|
|
81
|
+
const brand = escapeHtml(options.brand ?? CONSOLE.brand);
|
|
82
|
+
const title = escapeHtml(options.title ?? copy.title);
|
|
83
|
+
const message = escapeHtml(options.message ?? copy.message);
|
|
84
|
+
const accent = safeColor(options.accent ?? CONSOLE.accent);
|
|
85
|
+
const nonceAttr = info.nonce !== undefined ? ` nonce="${escapeHtml(info.nonce)}"` : '';
|
|
86
|
+
const loginHref = options.loginHref === false
|
|
87
|
+
? null
|
|
88
|
+
: (safeHref(options.loginHref ?? info.loginHref ?? '') ?? null);
|
|
89
|
+
const homeHref = options.homeHref === false ? null : safeHref(options.homeHref ?? '/');
|
|
90
|
+
const buttons = [];
|
|
91
|
+
if (loginHref !== null && info.reason !== 'forbidden') {
|
|
92
|
+
buttons.push(`<a class="btn primary" href="${escapeHtml(loginHref)}">${KEY_ICON}${escapeHtml(options.loginLabel ?? 'Sign in')}</a>`);
|
|
93
|
+
}
|
|
94
|
+
if (homeHref !== null) {
|
|
95
|
+
buttons.push(`<a class="btn${buttons.length === 0 ? ' primary' : ''}" href="${escapeHtml(homeHref)}">${escapeHtml(options.homeLabel ?? 'Back to app')}</a>`);
|
|
96
|
+
}
|
|
97
|
+
if (loginHref !== null && info.reason === 'forbidden') {
|
|
98
|
+
// A forbidden user might simply be the wrong user: offer a way to switch accounts, second.
|
|
99
|
+
buttons.push(`<a class="btn" href="${escapeHtml(loginHref)}">${escapeHtml(options.loginLabel ?? 'Sign in as someone else')}</a>`);
|
|
100
|
+
}
|
|
101
|
+
const detail = info.detail !== undefined && info.detail !== ''
|
|
102
|
+
? `\n <p class="detail">${escapeHtml(info.detail)}</p>`
|
|
103
|
+
: '';
|
|
104
|
+
const actions = buttons.length > 0 ? `\n <div class="actions">${buttons.join('')}</div>` : '';
|
|
105
|
+
return `<!doctype html>
|
|
106
|
+
<html lang="en">
|
|
107
|
+
<head>
|
|
108
|
+
<meta charset="utf-8" />
|
|
109
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
110
|
+
<meta name="robots" content="noindex, nofollow" />
|
|
111
|
+
<title>${title} — ${brand}</title>
|
|
112
|
+
<style${nonceAttr}>
|
|
113
|
+
:root {
|
|
114
|
+
color-scheme: dark;
|
|
115
|
+
--bg: #09090b;
|
|
116
|
+
--panel: #0c0c0f;
|
|
117
|
+
--panel-2: #101017;
|
|
118
|
+
--line: #1c1c22;
|
|
119
|
+
--text: #e7e7ea;
|
|
120
|
+
--muted: #76767f;
|
|
121
|
+
--bad: #f87171;
|
|
122
|
+
--accent: ${accent};
|
|
123
|
+
}
|
|
124
|
+
* { box-sizing: border-box; }
|
|
125
|
+
body {
|
|
126
|
+
margin: 0;
|
|
127
|
+
min-height: 100vh;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
justify-content: center;
|
|
131
|
+
padding: 24px;
|
|
132
|
+
background:
|
|
133
|
+
radial-gradient(900px 480px at 50% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
|
|
134
|
+
var(--bg);
|
|
135
|
+
color: var(--text);
|
|
136
|
+
font: 15px/1.6 "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
137
|
+
-webkit-font-smoothing: antialiased;
|
|
138
|
+
}
|
|
139
|
+
.card {
|
|
140
|
+
position: relative;
|
|
141
|
+
overflow: hidden;
|
|
142
|
+
width: 100%;
|
|
143
|
+
max-width: 440px;
|
|
144
|
+
padding: 36px 32px 28px;
|
|
145
|
+
background: var(--panel);
|
|
146
|
+
border: 1px solid var(--line);
|
|
147
|
+
border-radius: 12px;
|
|
148
|
+
box-shadow: 0 30px 60px -24px rgb(0 0 0 / 0.7);
|
|
149
|
+
}
|
|
150
|
+
.card::before {
|
|
151
|
+
content: "";
|
|
152
|
+
position: absolute;
|
|
153
|
+
inset: 0 0 auto 0;
|
|
154
|
+
height: 2px;
|
|
155
|
+
background: linear-gradient(90deg, var(--accent), transparent 80%);
|
|
156
|
+
}
|
|
157
|
+
.eyebrow {
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
gap: 10px;
|
|
161
|
+
margin: 0 0 22px;
|
|
162
|
+
font: 11px/1 "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
163
|
+
letter-spacing: 0.12em;
|
|
164
|
+
text-transform: uppercase;
|
|
165
|
+
color: var(--muted);
|
|
166
|
+
}
|
|
167
|
+
.eyebrow .brand { color: var(--accent); }
|
|
168
|
+
.eyebrow .status {
|
|
169
|
+
margin-left: auto;
|
|
170
|
+
padding: 4px 7px;
|
|
171
|
+
border: 1px solid var(--line);
|
|
172
|
+
border-radius: 4px;
|
|
173
|
+
color: var(--bad);
|
|
174
|
+
letter-spacing: 0.08em;
|
|
175
|
+
}
|
|
176
|
+
.icon {
|
|
177
|
+
display: grid;
|
|
178
|
+
place-items: center;
|
|
179
|
+
width: 40px;
|
|
180
|
+
height: 40px;
|
|
181
|
+
margin-bottom: 18px;
|
|
182
|
+
border-radius: 10px;
|
|
183
|
+
background: color-mix(in srgb, var(--accent) 12%, transparent);
|
|
184
|
+
color: var(--accent);
|
|
185
|
+
}
|
|
186
|
+
h1 {
|
|
187
|
+
margin: 0 0 8px;
|
|
188
|
+
font-size: 22px;
|
|
189
|
+
font-weight: 600;
|
|
190
|
+
letter-spacing: -0.01em;
|
|
191
|
+
}
|
|
192
|
+
p { margin: 0; color: var(--muted); }
|
|
193
|
+
.detail {
|
|
194
|
+
margin-top: 14px;
|
|
195
|
+
padding: 10px 12px;
|
|
196
|
+
border: 1px solid var(--line);
|
|
197
|
+
border-radius: 6px;
|
|
198
|
+
background: var(--panel-2);
|
|
199
|
+
font: 12px/1.5 "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
200
|
+
color: var(--text);
|
|
201
|
+
overflow-wrap: anywhere;
|
|
202
|
+
}
|
|
203
|
+
.actions {
|
|
204
|
+
display: flex;
|
|
205
|
+
flex-wrap: wrap;
|
|
206
|
+
gap: 10px;
|
|
207
|
+
margin-top: 26px;
|
|
208
|
+
}
|
|
209
|
+
.btn {
|
|
210
|
+
display: inline-flex;
|
|
211
|
+
align-items: center;
|
|
212
|
+
gap: 8px;
|
|
213
|
+
padding: 9px 14px;
|
|
214
|
+
border: 1px solid var(--line);
|
|
215
|
+
border-radius: 6px;
|
|
216
|
+
background: var(--panel-2);
|
|
217
|
+
color: var(--text);
|
|
218
|
+
font-size: 13px;
|
|
219
|
+
font-weight: 500;
|
|
220
|
+
text-decoration: none;
|
|
221
|
+
}
|
|
222
|
+
.btn:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
|
|
223
|
+
.btn.primary {
|
|
224
|
+
background: color-mix(in srgb, var(--accent) 14%, transparent);
|
|
225
|
+
border-color: color-mix(in srgb, var(--accent) 45%, transparent);
|
|
226
|
+
color: var(--accent);
|
|
227
|
+
}
|
|
228
|
+
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
|
|
229
|
+
.foot {
|
|
230
|
+
margin-top: 26px;
|
|
231
|
+
font: 11px/1 "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
232
|
+
letter-spacing: 0.04em;
|
|
233
|
+
color: var(--muted);
|
|
234
|
+
opacity: 0.7;
|
|
235
|
+
}
|
|
236
|
+
</style>
|
|
237
|
+
</head>
|
|
238
|
+
<body>
|
|
239
|
+
<main class="card">
|
|
240
|
+
<p class="eyebrow"><span class="brand">${brand}</span><span>console</span><span class="status">${info.status}</span></p>
|
|
241
|
+
<div class="icon" aria-hidden="true">${info.reason === 'forbidden' ? LOCK_ICON : KEY_ICON}</div>
|
|
242
|
+
<h1>${title}</h1>
|
|
243
|
+
<p>${message}</p>${detail}${actions}
|
|
244
|
+
<p class="foot">${escapeHtml(CONSOLE.packageName)}</p>
|
|
245
|
+
</main>
|
|
246
|
+
</body>
|
|
247
|
+
</html>`;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Resolve WHAT to serve for a refusal, honouring the host's `accessDenied` option in either form.
|
|
251
|
+
* Returns the HTML to send, or `null` when a custom renderer already answered the request itself
|
|
252
|
+
* (`answered()` reports whether it did — the provider wires that to "a `location` header or a body
|
|
253
|
+
* is already set"). Framework-light: knows nothing about the HTTP context beyond passing it through.
|
|
254
|
+
*/
|
|
255
|
+
export async function resolveAccessDeniedPage(info, option, ctx, answered) {
|
|
256
|
+
if (typeof option === 'function') {
|
|
257
|
+
const rendered = await option(info, ctx);
|
|
258
|
+
if (typeof rendered === 'string')
|
|
259
|
+
return rendered;
|
|
260
|
+
if (answered())
|
|
261
|
+
return null;
|
|
262
|
+
return renderAccessDeniedPage(info);
|
|
263
|
+
}
|
|
264
|
+
return renderAccessDeniedPage(info, option ?? {});
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=access_denied_page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access_denied_page.js","sourceRoot":"","sources":["../../../src/dashboard/access_denied_page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAoEH,kGAAkG;AAClG,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,SAAS;IACjB,WAAW,EAAE,wBAAwB;CAC7B,CAAC;AAEX,MAAM,YAAY,GAAmE;IACnF,eAAe,EAAE;QACf,KAAK,EAAE,kBAAkB;QACzB,OAAO,EAAE,gDAAgD;KAC1D;IACD,SAAS,EAAE;QACT,KAAK,EAAE,eAAe;QACtB,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,GAAQ,EACR,QAAuB;IAEvB,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACzC,IAAI,OAAO,QAAQ,KAAK,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAClD,IAAI,QAAQ,EAAE;YAAE,OAAO,IAAI,CAAC;QAC5B,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,sBAAsB,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { HttpContext } from '@adonisjs/core/http';
|
|
2
|
+
import type { AccessDeniedOption as GenericAccessDeniedOption, AccessDeniedRenderer as GenericAccessDeniedRenderer } from './access_denied_page.js';
|
|
2
3
|
import { type DashboardAuthOptions, type ResolvedDashboardAuth } from './auth.js';
|
|
4
|
+
/**
|
|
5
|
+
* The function form of {@link PaymentsDashboardConfig.accessDenied}: render (or answer) a refused
|
|
6
|
+
* page navigation yourself. Receives the refusal ({@link AccessDeniedInfo}) and the AdonisJS
|
|
7
|
+
* {@link HttpContext}. Return an HTML string to have it served; answer the request yourself (a
|
|
8
|
+
* redirect, most commonly) and return nothing to make the provider stand down; return nothing
|
|
9
|
+
* WITHOUT answering and the built-in page is served.
|
|
10
|
+
*/
|
|
11
|
+
export type AccessDeniedRenderer = GenericAccessDeniedRenderer<HttpContext>;
|
|
12
|
+
/** `accessDenied` in either form — an options object for the built-in page, or a renderer. */
|
|
13
|
+
export type AccessDeniedOption = GenericAccessDeniedOption<HttpContext>;
|
|
3
14
|
/**
|
|
4
15
|
* Authorization guard for the dashboard. Runs before every dashboard route
|
|
5
16
|
* (API + HTML). Return `true` to allow the request, `false` to deny it (the
|
|
@@ -53,6 +64,19 @@ export interface PaymentsDashboardConfig {
|
|
|
53
64
|
* session guard. Missing `secret`/`login` fails closed at boot.
|
|
54
65
|
*/
|
|
55
66
|
dashboardAuth?: DashboardAuthOptions;
|
|
67
|
+
/**
|
|
68
|
+
* What a BROWSER sees when the guard refuses a page navigation (the SPA shell, its assets, or —
|
|
69
|
+
* Mode A only — a session-less visit). API requests are unaffected: they keep getting the JSON
|
|
70
|
+
* the SPA relies on (`403 { error: 'forbidden' }` / `401 { error: 'unauthorized', auth }`).
|
|
71
|
+
*
|
|
72
|
+
* Omit it for the built-in page — a dark card in the console's own visual language, with the
|
|
73
|
+
* status, a sentence explaining the refusal, a "Back to app" link and, when `dashboardAuth.login`
|
|
74
|
+
* exists, a "Sign in" button. Pass an object to tweak that page (`brand`, `title`, `message`,
|
|
75
|
+
* `homeHref`, `loginHref`, `accent`, …), or a function to render/answer it yourself — see
|
|
76
|
+
* {@link AccessDeniedRenderer}. Either way, an `authorize` hook that already wrote a redirect
|
|
77
|
+
* still wins: the provider never overwrites a `location` header.
|
|
78
|
+
*/
|
|
79
|
+
accessDenied?: AccessDeniedOption;
|
|
56
80
|
}
|
|
57
81
|
/** A fully-resolved config — every field present (defaults applied). */
|
|
58
82
|
export interface ResolvedPaymentsDashboardConfig {
|
|
@@ -62,6 +86,8 @@ export interface ResolvedPaymentsDashboardConfig {
|
|
|
62
86
|
authorize: AuthorizeHook;
|
|
63
87
|
/** Resolved built-in login config, or `null` when `dashboardAuth` is unconfigured. */
|
|
64
88
|
dashboardAuth: ResolvedDashboardAuth | null;
|
|
89
|
+
/** The host's `accessDenied` option as given, or `null` for the built-in page with defaults. */
|
|
90
|
+
accessDenied: AccessDeniedOption | null;
|
|
65
91
|
}
|
|
66
92
|
/**
|
|
67
93
|
* The default guard: open outside production; in production it requires a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define_config.d.ts","sourceRoot":"","sources":["../../../src/dashboard/define_config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,K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C,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC;AAED,wEAAwE;AACxE,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,aAAa,CAAC;IACzB,sFAAsF;IACtF,aAAa,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC5C,gGAAgG;IAChG,YAAY,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzC;AAyCD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAQ1D;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAC3B,MAAM,GAAE,uBAA4B,GACnC,+BAA+B,CAcjC;AAED,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,MAAM,GAAE,uBAA4B,GAAG,uBAAuB,CAE1F"}
|
|
@@ -74,6 +74,7 @@ export function resolveConfig(config = {}) {
|
|
|
74
74
|
// Validate + resolve now so a misconfigured secret/login fails closed at boot,
|
|
75
75
|
// not on the first login attempt. `null` when `dashboardAuth` is omitted.
|
|
76
76
|
dashboardAuth: resolveDashboardAuth(config.dashboardAuth),
|
|
77
|
+
accessDenied: config.accessDenied ?? null,
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
/** Identity helper giving `config/payments_dashboard.ts` full type-checking. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../../src/dashboard/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM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J,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,YAAY,CAAC,MAAM,GAA4B,EAAE;IAC/D,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
2
|
export declare const VERSION = "0.2.0";
|
|
3
|
+
export type { AccessDeniedInfo, AccessDeniedPageOptions, AccessDeniedReason, } from './access_denied_page.js';
|
|
4
|
+
export { CONSOLE as ACCESS_DENIED_CONSOLE, escapeHtml, renderAccessDeniedPage, resolveAccessDeniedPage, } from './access_denied_page.js';
|
|
3
5
|
export type { RefundAction, RefundCapableDriver, RefundOutcome, ReplayAction, ReplayableWebhookEvent, ReplayOutcome, } from './actions.js';
|
|
4
6
|
export { createRefundAction, createReplayAction } from './actions.js';
|
|
5
7
|
export type { AuthMode, DashboardAuthOptions, LoginHook, LoginOutcome, ResolvedDashboardAuth, SessionHook, SessionOutcome, } from './auth.js';
|
|
6
8
|
export { performLogin, performSession, readSession, resolveDashboardAuth, SESSION_COOKIE_NAME, sanitizeReturnTo, } from './auth.js';
|
|
7
|
-
export type { AuthorizeHook, PaymentsDashboardConfig, ResolvedPaymentsDashboardConfig, } from './define_config.js';
|
|
9
|
+
export type { AccessDeniedOption, AccessDeniedRenderer, AuthorizeHook, PaymentsDashboardConfig, ResolvedPaymentsDashboardConfig, } from './define_config.js';
|
|
8
10
|
export { defaultAuthorize, defineConfig, resolveConfig } from './define_config.js';
|
|
9
11
|
export type { ApiRequest, ApiResponse, DashboardActions, Deps } from './handlers.js';
|
|
10
12
|
export { AUDIT_ACTION_FILTERS, auditEvents, customers, DISPUTE_DEFAULT_DUE_WITHIN_HOURS, DISPUTE_RESOLUTION_STATUSES, DISPUTE_STATUSES, disputes, health, ok, overview, PAYMENT_STATUSES, PROVIDER_SCAN_CAP, paymentDetail, payments, providers, refundPayment, resolveDispute, retryWebhookEvent, SUBSCRIPTION_DEFAULT_STATUS, SUBSCRIPTION_STATUSES, subscriptions, WEBHOOK_EVENT_STATUSES, webhookEvents, } from './handlers.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACtE,YAAY,EACV,QAAQ,EACR,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,qBAAqB,EACrB,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,aAAa,EACb,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnF,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,SAAS,EACT,gCAAgC,EAChC,2BAA2B,EAC3B,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,EAAE,EACF,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,2BAA2B,EAC3B,qBAAqB,EACrB,aAAa,EACb,sBAAsB,EACtB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,GAChB,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,YAAY,EACV,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,OAAO,IAAI,qBAAqB,EAChC,UAAU,EACV,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACtE,YAAY,EACV,QAAQ,EACR,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,qBAAqB,EACrB,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnF,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,SAAS,EACT,gCAAgC,EAChC,2BAA2B,EAC3B,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,EAAE,EACF,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,2BAA2B,EAC3B,qBAAqB,EACrB,aAAa,EACb,sBAAsB,EACtB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,GAChB,MAAM,UAAU,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
2
|
export const VERSION = '0.2.0';
|
|
3
|
+
// The built-in "access denied" page (what a browser sees on a refused page navigation).
|
|
4
|
+
export { CONSOLE as ACCESS_DENIED_CONSOLE, escapeHtml, renderAccessDeniedPage, resolveAccessDeniedPage, } from './access_denied_page.js';
|
|
3
5
|
// The two WRITE actions (refund + webhook retry), as framework-light ports.
|
|
4
6
|
export { createRefundAction, createReplayAction } from './actions.js';
|
|
5
7
|
// Built-in `dashboardAuth` login screen (optional; opt-in via `config/payments_dashboard.ts`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAO/B,wFAAwF;AACxF,OAAO,EACL,OAAO,IAAI,qBAAqB,EAChC,UAAU,EACV,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AASjC,4EAA4E;AAC5E,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAUtE,+FAA+F;AAC/F,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAQnB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnF,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,SAAS,EACT,gCAAgC,EAChC,2BAA2B,EAC3B,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,EAAE,EACF,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,2BAA2B,EAC3B,qBAAqB,EACrB,aAAa,EACb,sBAAsB,EACtB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO5E,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,GAChB,MAAM,UAAU,CAAC"}
|
|
@@ -3,21 +3,34 @@
|
|
|
3
3
|
* dependency-free, hand-authored HTML page — NOT part of the bundled dashboard SPA — so gating the
|
|
4
4
|
* dashboard shell doesn't require rebuilding or extending the bundled SPA.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* It works WITHOUT JavaScript: the markup is a classic `<form method="post">` carrying `returnTo`
|
|
7
|
+
* in a hidden field, and the provider answers a form-encoded `POST` with a redirect (to `returnTo`
|
|
8
|
+
* on success, back here with `?error` on failure). The inline `<script>` is progressive
|
|
9
|
+
* enhancement only — it swaps the full-page round trip for a JSON `fetch` and shows the error in
|
|
10
|
+
* place — and it carries the request's CSP nonce when the provider hands one over, so a host
|
|
11
|
+
* running `@adonisjs/shield`'s `script-src 'self' @nonce` keeps the enhancement instead of a
|
|
12
|
+
* dead form. The `<style>` takes the same nonce.
|
|
13
|
+
*
|
|
14
|
+
* The only per-request values interpolated are `returnTo` (already passed through
|
|
15
|
+
* {@link sanitizeReturnTo}, so it is a root-relative path) and the `error` flag; both go through
|
|
16
|
+
* {@link escapeHtml} (and `JSON.stringify` inside the script) so nothing in the query string can
|
|
17
|
+
* break out of an attribute or the script. `basePath` is developer-controlled config.
|
|
11
18
|
*
|
|
12
19
|
* The visual language (dark zinc card, mono type, emerald accent) mirrors the Agora consoles so
|
|
13
|
-
* they feel like one family.
|
|
14
|
-
* `redirectTo` it gets back (rather than a classic form POST + server redirect), which is why the
|
|
15
|
-
* markup keeps its own `<script>`.
|
|
20
|
+
* they feel like one family.
|
|
16
21
|
*
|
|
17
22
|
* The password input has NO `required` attribute and the value is forwarded AS-IS (empty string
|
|
18
23
|
* when blank): the host's `login` hook — not this page — decides whether a password matters, so an
|
|
19
24
|
* email-only host (gate on username, ignore password) works with the same page as a host with real
|
|
20
25
|
* passwords.
|
|
21
26
|
*/
|
|
22
|
-
export
|
|
27
|
+
export interface LoginPageOptions {
|
|
28
|
+
/** The request's CSP nonce, applied to the inline `<style>` and `<script>`. */
|
|
29
|
+
nonce?: string;
|
|
30
|
+
/** Render the "Invalid username or password." notice (the no-JS failure round trip). */
|
|
31
|
+
error?: boolean;
|
|
32
|
+
/** Where to send the operator after a successful sign-in. Sanitized here; default `basePath`. */
|
|
33
|
+
returnTo?: unknown;
|
|
34
|
+
}
|
|
35
|
+
export declare function renderLoginPage(basePath: string, options?: LoginPageOptions): string;
|
|
23
36
|
//# sourceMappingURL=login_page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login_page.d.ts","sourceRoot":"","sources":["../../../src/dashboard/login_page.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login_page.d.ts","sourceRoot":"","sources":["../../../src/dashboard/login_page.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iGAAiG;IACjG,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAkBD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CA2IxF"}
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
+
import { escapeHtml } from './access_denied_page.js';
|
|
2
|
+
import { sanitizeReturnTo } from './auth.js';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
7
|
-
* into the HTML), so this function's only per-request-ish input is `basePath` — a developer-
|
|
8
|
-
* controlled config value, not user input — and the page body is otherwise a static template.
|
|
9
|
-
* This sidesteps HTML-escaping entirely: there is no reflected query-param interpolation surface
|
|
10
|
-
* to get wrong.
|
|
11
|
-
*
|
|
12
|
-
* The visual language (dark zinc card, mono type, emerald accent) mirrors the Agora consoles so
|
|
13
|
-
* they feel like one family. The submit flow POSTs JSON via `fetch` and follows the JSON
|
|
14
|
-
* `redirectTo` it gets back (rather than a classic form POST + server redirect), which is why the
|
|
15
|
-
* markup keeps its own `<script>`.
|
|
16
|
-
*
|
|
17
|
-
* The password input has NO `required` attribute and the value is forwarded AS-IS (empty string
|
|
18
|
-
* when blank): the host's `login` hook — not this page — decides whether a password matters, so an
|
|
19
|
-
* email-only host (gate on username, ignore password) works with the same page as a host with real
|
|
20
|
-
* passwords.
|
|
4
|
+
* JSON for embedding INSIDE an inline `<script>`: `JSON.stringify` alone leaves `</script>` (and
|
|
5
|
+
* `<!--`) untouched, and the HTML parser ends the script element on the first `</script>` it sees
|
|
6
|
+
* regardless of JavaScript string boundaries — so a `returnTo` of `/x</script><script>…` would run.
|
|
7
|
+
* Escaping the angle brackets (and `&`, plus the two line terminators JSON allows but JS doesn't)
|
|
8
|
+
* as `\uXXXX` keeps the value byte-identical once parsed and inert to the HTML parser.
|
|
21
9
|
*/
|
|
22
|
-
|
|
10
|
+
function jsonForScript(value) {
|
|
11
|
+
return JSON.stringify(value)
|
|
12
|
+
.replaceAll('<', '\\u003c')
|
|
13
|
+
.replaceAll('>', '\\u003e')
|
|
14
|
+
.replaceAll('&', '\\u0026')
|
|
15
|
+
.replaceAll('\u2028', '\\u2028')
|
|
16
|
+
.replaceAll('\u2029', '\\u2029');
|
|
17
|
+
}
|
|
18
|
+
export function renderLoginPage(basePath, options = {}) {
|
|
23
19
|
const loginAction = `${basePath}/login`;
|
|
24
20
|
const defaultReturnTo = basePath === '' ? '/' : basePath;
|
|
21
|
+
const returnTo = sanitizeReturnTo(options.returnTo, defaultReturnTo);
|
|
22
|
+
const nonceAttr = options.nonce !== undefined ? ` nonce="${escapeHtml(options.nonce)}"` : '';
|
|
23
|
+
const errorStyle = options.error ? ' style="display:block"' : '';
|
|
25
24
|
return `<!doctype html>
|
|
26
25
|
<html lang="en">
|
|
27
26
|
<head>
|
|
@@ -29,7 +28,7 @@ export function renderLoginPage(basePath) {
|
|
|
29
28
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
30
29
|
<meta name="robots" content="noindex, nofollow" />
|
|
31
30
|
<title>Sign in — Payments</title>
|
|
32
|
-
<style>
|
|
31
|
+
<style${nonceAttr}>
|
|
33
32
|
:root { color-scheme: dark; }
|
|
34
33
|
* { box-sizing: border-box; }
|
|
35
34
|
body {
|
|
@@ -104,7 +103,8 @@ export function renderLoginPage(basePath) {
|
|
|
104
103
|
<body>
|
|
105
104
|
<div class="card">
|
|
106
105
|
<p class="brand">Payments</p>
|
|
107
|
-
<form id="login-form" autocomplete="on">
|
|
106
|
+
<form id="login-form" method="post" action="${escapeHtml(loginAction)}" autocomplete="on">
|
|
107
|
+
<input type="hidden" name="returnTo" value="${escapeHtml(returnTo)}" />
|
|
108
108
|
<label>
|
|
109
109
|
<span class="field-label">Username</span>
|
|
110
110
|
<input id="username" name="username" type="text" autocomplete="username" required autofocus />
|
|
@@ -113,41 +113,29 @@ export function renderLoginPage(basePath) {
|
|
|
113
113
|
<span class="field-label">Password</span>
|
|
114
114
|
<input id="password" name="password" type="password" autocomplete="current-password" />
|
|
115
115
|
</label>
|
|
116
|
-
<p id="error" role="alert">Invalid username or password.</p>
|
|
116
|
+
<p id="error" role="alert"${errorStyle}>Invalid username or password.</p>
|
|
117
117
|
<button id="submit" type="submit">Sign in</button>
|
|
118
118
|
</form>
|
|
119
119
|
</div>
|
|
120
|
-
<script>
|
|
120
|
+
<script${nonceAttr}>
|
|
121
121
|
(function () {
|
|
122
|
-
var LOGIN_ACTION = ${
|
|
123
|
-
var
|
|
124
|
-
var params = new URLSearchParams(window.location.search);
|
|
122
|
+
var LOGIN_ACTION = ${jsonForScript(loginAction)};
|
|
123
|
+
var RETURN_TO = ${jsonForScript(returnTo)};
|
|
125
124
|
var errorBox = document.getElementById('error');
|
|
126
|
-
if (params.get('error')) errorBox.style.display = 'block';
|
|
127
|
-
|
|
128
|
-
function sameOriginReturnTo(value) {
|
|
129
|
-
if (typeof value !== 'string' || value === '') return DEFAULT_RETURN_TO;
|
|
130
|
-
if (value.charAt(0) !== '/' || value.charAt(1) === '/' || value.indexOf('://') !== -1) {
|
|
131
|
-
return DEFAULT_RETURN_TO;
|
|
132
|
-
}
|
|
133
|
-
return value;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
125
|
var form = document.getElementById('login-form');
|
|
137
126
|
var submitButton = document.getElementById('submit');
|
|
138
127
|
form.addEventListener('submit', function (event) {
|
|
139
128
|
event.preventDefault();
|
|
140
129
|
submitButton.disabled = true;
|
|
141
130
|
errorBox.style.display = 'none';
|
|
142
|
-
var returnTo = sameOriginReturnTo(params.get('returnTo'));
|
|
143
131
|
fetch(LOGIN_ACTION, {
|
|
144
132
|
method: 'POST',
|
|
145
|
-
headers: { 'content-type': 'application/json' },
|
|
133
|
+
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
146
134
|
credentials: 'same-origin',
|
|
147
135
|
body: JSON.stringify({
|
|
148
136
|
username: document.getElementById('username').value,
|
|
149
137
|
password: document.getElementById('password').value,
|
|
150
|
-
returnTo:
|
|
138
|
+
returnTo: RETURN_TO,
|
|
151
139
|
}),
|
|
152
140
|
})
|
|
153
141
|
.then(function (response) {
|
|
@@ -155,7 +143,7 @@ export function renderLoginPage(basePath) {
|
|
|
155
143
|
return response.json();
|
|
156
144
|
})
|
|
157
145
|
.then(function (data) {
|
|
158
|
-
window.location.href = data.redirectTo ||
|
|
146
|
+
window.location.href = data.redirectTo || RETURN_TO;
|
|
159
147
|
})
|
|
160
148
|
.catch(function () {
|
|
161
149
|
errorBox.style.display = 'block';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login_page.js","sourceRoot":"","sources":["../../../src/dashboard/login_page.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"login_page.js","sourceRoot":"","sources":["../../../src/dashboard/login_page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAqC7C;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;SACzB,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC;SAC1B,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC;SAC1B,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC;SAC1B,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC/B,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAgB,EAAE,OAAO,GAAqB,EAAE;IAC9E,MAAM,WAAW,GAAG,GAAG,QAAQ,QAAQ,CAAC;IACxC,MAAM,eAAe,GAAG,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC;IACzD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IACrE,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,OAAO;;;;;;;QAOD,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDA2EiC,UAAU,CAAC,WAAW,CAAC;oDACrB,UAAU,CAAC,QAAQ,CAAC;;;;;;;;;kCAStC,UAAU;;;;SAInC,SAAS;;uBAEK,aAAa,CAAC,WAAW,CAAC;oBAC7B,aAAa,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAiCnC,CAAC;AACT,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/payments",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Billing library for AdonisJS — 18 payment gateways behind one driver contract, with a Cashier-style subscription billing layer: Billable mixin, Lucid stores, idempotent webhook processing and an optional Durable-backed dispatcher. Part of the Agora ecosystem.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|