add nonce to token tables just in case, add public key token type for future auth features
This commit is contained in:
parent
4b4cd88698
commit
991bc68624
27
src/migration/1662882569739-tokentypes.ts
Normal file
27
src/migration/1662882569739-tokentypes.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
|
|
||||||
|
export class tokentypes1662882569739 implements MigrationInterface {
|
||||||
|
name = 'tokentypes1662882569739';
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE \`user_token\` ADD \`nonce\` text NULL`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE \`o_auth2_token\` ADD \`nonce\` text NULL`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE \`user_token\` CHANGE \`type\` \`type\` enum ('generic', 'activation', 'deactivation', 'password', 'login', 'gdpr', 'totp', 'public_key', 'recovery') NOT NULL`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE \`user_token\` CHANGE \`type\` \`type\` enum ('generic', 'activation', 'deactivation', 'password', 'login', 'gdpr', 'totp', 'recovery') NOT NULL`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`user_token\` DROP COLUMN \`nonce\``);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE \`o_auth2_token\` DROP COLUMN \`nonce\``,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -26,6 +26,9 @@ export class OAuth2Token {
|
|||||||
@Column({ nullable: false, type: 'text' })
|
@Column({ nullable: false, type: 'text' })
|
||||||
token: string;
|
token: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true, type: 'text' })
|
||||||
|
nonce: string;
|
||||||
|
|
||||||
@Column({ type: 'text', nullable: true })
|
@Column({ type: 'text', nullable: true })
|
||||||
scope: string;
|
scope: string;
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ export enum UserTokenType {
|
|||||||
LOGIN = 'login',
|
LOGIN = 'login',
|
||||||
GDPR = 'gdpr',
|
GDPR = 'gdpr',
|
||||||
TOTP = 'totp',
|
TOTP = 'totp',
|
||||||
|
PUBLIC_KEY = 'public_key',
|
||||||
RECOVERY = 'recovery',
|
RECOVERY = 'recovery',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,6 +27,9 @@ export class UserToken {
|
|||||||
@Column({ nullable: false, type: 'text' })
|
@Column({ nullable: false, type: 'text' })
|
||||||
token: string;
|
token: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true, type: 'text' })
|
||||||
|
nonce: string;
|
||||||
|
|
||||||
@Column({ type: 'enum', enum: UserTokenType, nullable: false })
|
@Column({ type: 'enum', enum: UserTokenType, nullable: false })
|
||||||
type: UserTokenType;
|
type: UserTokenType;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user