mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) revive saml support and test against Auth0
Summary: SAML support had broken due to SameSite changes in browsers. This makes it work again, and tests it against Auth0 (now owned by Okta). Logging in and out works. The logged out state is confusing, and may not be complete. The "Add Account" menu item doesn't work. But with this, an important part of self-hosting becomes easier. SAML support works also in grist-core, for site pages, but there is a glitch on document pages that I'll look into separately. Test Plan: tested manually Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2976
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import {GristLoginMiddleware} from 'app/server/lib/GristServer';
|
||||
import {GristLoginMiddleware, GristServer} from 'app/server/lib/GristServer';
|
||||
import {getSamlLoginMiddleware} from 'app/server/lib/SamlConfig';
|
||||
|
||||
export async function getLoginMiddleware(): Promise<GristLoginMiddleware> {
|
||||
export async function getLoginMiddleware(gristServer: GristServer): Promise<GristLoginMiddleware> {
|
||||
const saml = await getSamlLoginMiddleware(gristServer);
|
||||
if (saml) { return saml; }
|
||||
return {
|
||||
async getLoginRedirectUrl(target: URL) { throw new Error('logins not implemented'); },
|
||||
async getLogoutRedirectUrl(target: URL) { throw new Error('logins not implemented'); },
|
||||
async getSignUpRedirectUrl(target: URL) { throw new Error('logins not implemented'); },
|
||||
addEndpoints(...args: any[]) {
|
||||
return "no-logins";
|
||||
}
|
||||
async getLoginRedirectUrl() { throw new Error('logins not implemented'); },
|
||||
async getLogoutRedirectUrl() { throw new Error('logins not implemented'); },
|
||||
async getSignUpRedirectUrl() { throw new Error('logins not implemented'); },
|
||||
addEndpoints() { return "no-logins"; }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -41,8 +41,10 @@ export async function main() {
|
||||
console.log('For full logs, re-run with DEBUG=1');
|
||||
}
|
||||
|
||||
// There's no login system released yet, so set a default email address.
|
||||
setDefaultEnv('GRIST_DEFAULT_EMAIL', 'you@example.com');
|
||||
// If SAML is not configured, there's no login system, so force a default email address.
|
||||
if (!process.env.GRIST_SAML_SP_HOST) {
|
||||
setDefaultEnv('GRIST_DEFAULT_EMAIL', 'you@example.com');
|
||||
}
|
||||
// Set directory for uploaded documents.
|
||||
setDefaultEnv('GRIST_DATA_DIR', 'docs');
|
||||
await fse.mkdirp(process.env.GRIST_DATA_DIR!);
|
||||
|
||||
Reference in New Issue
Block a user