feat: Move to passport for authentication (#1934)

- Added `accountProvisioner`
- Move authentication to use passport strategies
- Make authentication more pluggable
- Change language of services -> providers

closes #1120
This commit is contained in:
Tom Moor
2021-03-11 10:02:22 -08:00
committed by GitHub
parent dc967be4fc
commit 5d6f68d399
33 changed files with 1104 additions and 725 deletions

View File

@ -10,6 +10,7 @@ import {
} from "../../shared/utils/domains";
import { ValidationError } from "../errors";
import { DataTypes, sequelize, Op } from "../sequelize";
import { generateAvatarUrl } from "../utils/avatars";
import { publicS3Endpoint, uploadToS3FromUrl } from "../utils/s3";
import Collection from "./Collection";
@ -66,7 +67,6 @@ const Team = sequelize.define(
allowNull: false,
defaultValue: true,
},
slackData: DataTypes.JSONB,
},
{
paranoid: true,
@ -85,7 +85,11 @@ const Team = sequelize.define(
},
logoUrl() {
return (
this.avatarUrl || (this.slackData ? this.slackData.image_88 : null)
this.avatarUrl ||
generateAvatarUrl({
id: this.id,
name: this.name,
})
);
},
},
@ -164,17 +168,10 @@ Team.prototype.provisionFirstCollection = async function (userId) {
"Our Editor",
"What is Outline",
];
for (const title of onboardingDocs) {
const text = await readFile(
path.join(
__dirname,
"..",
"..",
"..",
"server",
"onboarding",
`${title}.md`
),
path.join(process.cwd(), "server", "onboarding", `${title}.md`),
"utf8"
);
const document = await Document.create({