chore: Migrate authentication to new tables (#1929)
This work provides a foundation for a more pluggable authentication system such as the one outlined in #1317. closes #1317
This commit is contained in:
24
server/models/UserAuthentication.js
Normal file
24
server/models/UserAuthentication.js
Normal file
@ -0,0 +1,24 @@
|
||||
// @flow
|
||||
import { DataTypes, sequelize, encryptedFields } from "../sequelize";
|
||||
|
||||
const UserAuthentication = sequelize.define("user_authentications", {
|
||||
id: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true,
|
||||
},
|
||||
scopes: DataTypes.ARRAY(DataTypes.STRING),
|
||||
accessToken: encryptedFields().vault("accessToken"),
|
||||
refreshToken: encryptedFields().vault("refreshToken"),
|
||||
providerId: {
|
||||
type: DataTypes.STRING,
|
||||
unique: true,
|
||||
},
|
||||
});
|
||||
|
||||
UserAuthentication.associate = (models) => {
|
||||
UserAuthentication.belongsTo(models.AuthenticationProvider);
|
||||
UserAuthentication.belongsTo(models.User);
|
||||
};
|
||||
|
||||
export default UserAuthentication;
|
Reference in New Issue
Block a user