login and authentication

login via totp
authentication via access and refresh tokens
This commit is contained in:
Julian Krauser 2024-08-22 11:40:31 +02:00
parent 6696975bee
commit e1ec65350d
28 changed files with 3750 additions and 0 deletions

17
src/entity/refresh.ts Normal file
View file

@ -0,0 +1,17 @@
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
import { user } from "./user";
@Entity()
export class refresh {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
token: string;
@Column({ type: "datetime" })
expiry: Date;
@ManyToOne(() => user)
user: user;
}

17
src/entity/user.ts Normal file
View file

@ -0,0 +1,17 @@
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
import { refresh } from "./refresh";
@Entity()
export class user {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
mail: string;
@Column({ type: "varchar", length: 255 })
username: string;
@Column({ type: "varchar", length: 255 })
secret: string;
}