mirror of
https://github.com/nestriness/nestri.git
synced 2026-11-26 17:09:52 +02:00
feat(auth): approving the installer says it adds a host
The device confirmation page asks "Is this you?" whatever is asking, which is right for signing an app in and undersells approving a computer as a host on your account. The issuer gains `deviceConfirm`, wording looked up by client id. It is chosen by the issuer and never built from the request, so a grant still cannot introduce itself in words of its own. The installer's page reads "Add a computer as a Nestri host?" over the code to compare with the terminal; every other client keeps the generic page. The preview gains the new state.
This commit is contained in:
@@ -49,6 +49,27 @@ const DEVICE_CLIENTS = new Set(['desktop', 'installer']);
|
||||
|
||||
export const allowDeviceClient = async (clientID: string) => DEVICE_CLIENTS.has(clientID);
|
||||
|
||||
/**
|
||||
* What the person approving a device client is asked, where it is not the
|
||||
* generic "is this you?".
|
||||
*
|
||||
* Approving the installer adds a computer to the person's account as a host,
|
||||
* which is a bigger thing to agree to than signing an app in, so the page says
|
||||
* that in as many words. Fixed per client id: nothing the request carries is
|
||||
* shown.
|
||||
*/
|
||||
export const deviceConfirm = (clientID: string) =>
|
||||
clientID === 'installer'
|
||||
? {
|
||||
heading: 'Add a computer as a Nestri host?',
|
||||
body: [
|
||||
'A computer is asking to become a host on your account. The code above should match the one in its terminal.'
|
||||
],
|
||||
footer:
|
||||
'If it does not, or you did not run the installer yourself, choose Deny. Approving lets that computer add itself as one host and nothing else.'
|
||||
}
|
||||
: undefined;
|
||||
|
||||
/**
|
||||
* How long a session for each device client lasts, where it is not the
|
||||
* default.
|
||||
@@ -210,6 +231,7 @@ export default {
|
||||
deviceStore: PostgresDeviceStore(),
|
||||
allowDeviceClient,
|
||||
clientTTL,
|
||||
deviceConfirm,
|
||||
// The default rule allows a redirect back to whatever hostname the
|
||||
// request arrived on, which is right for a site served beside this
|
||||
// one and refuses the proxy in front of user-owned hosts — it
|
||||
|
||||
Reference in New Issue
Block a user