mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Remove LoginSession, which was mainly serving situations that are no longer used.
Summary: In the past, Cognito sign-ins were intended to give authorization to some AWS services (like SQS); various tokens were stored in the session for this purpose. This is no longer used. Profiles from Cognito now serve a limited purpose: first-time initialization of name and picture, and keeping track of which login method was used. For these remaining needs, ScopedSession is sufficient. Test Plan: Existing test pass. Tested manually that logins work with Google and Email + Password. Tested manually that on a clean database, name and picture are picked up from a Google Login. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2907
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
import {UserProfile} from 'app/common/LoginSessionAPI';
|
||||
import {Client} from 'app/server/lib/Client';
|
||||
import {ILoginSession} from 'app/server/lib/ILoginSession';
|
||||
|
||||
export class LoginSession implements ILoginSession {
|
||||
public clients: Set<Client> = new Set();
|
||||
public async getEmail() {
|
||||
return process.env.GRIST_DEFAULT_EMAIL || 'anon@getgrist.com';
|
||||
}
|
||||
public async getSessionProfile() {
|
||||
return {
|
||||
name: await this.getEmail(),
|
||||
email: await this.getEmail(),
|
||||
};
|
||||
}
|
||||
public async clearSession(): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
public async testSetProfile(profile: UserProfile|null): Promise<void> {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
import {ActiveDoc} from 'app/server/lib/ActiveDoc';
|
||||
import {ICreate} from 'app/server/lib/ICreate';
|
||||
import {LoginSession} from 'app/server/lib/LoginSession';
|
||||
import {ScopedSession} from 'app/server/lib/BrowserSession';
|
||||
import {NSandboxCreator} from 'app/server/lib/NSandbox';
|
||||
|
||||
// Use raw python - update when pynbox or other solution is set up for core.
|
||||
const sandboxCreator = new NSandboxCreator('unsandboxed');
|
||||
|
||||
export const create: ICreate = {
|
||||
LoginSession() {
|
||||
return new LoginSession();
|
||||
adjustSession(scopedSession: ScopedSession): void {
|
||||
const email = process.env.GRIST_DEFAULT_EMAIL || 'anon@getgrist.com';
|
||||
const profile = {email, name: email};
|
||||
scopedSession.getSessionProfile = async () => profile;
|
||||
},
|
||||
Billing() {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user