mirror of
https://github.com/versia-pub/server.git
synced 2026-04-27 20:59:15 +02:00
refactor(api): ♻️ Rewrite full authentication code to go OpenID-only
This commit is contained in:
parent
4eae4cd062
commit
1bfc5fb013
39 changed files with 3076 additions and 2009 deletions
|
|
@ -15,7 +15,7 @@ import { BaseInterface } from "./base.ts";
|
|||
import { User } from "./user.ts";
|
||||
|
||||
type TokenType = InferSelectModel<typeof Tokens> & {
|
||||
application: typeof Application.$type | null;
|
||||
client: typeof Application.$type;
|
||||
};
|
||||
|
||||
export class Token extends BaseInterface<typeof Tokens, TokenType> {
|
||||
|
|
@ -51,7 +51,7 @@ export class Token extends BaseInterface<typeof Tokens, TokenType> {
|
|||
where: sql,
|
||||
orderBy,
|
||||
with: {
|
||||
application: true,
|
||||
client: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ export class Token extends BaseInterface<typeof Tokens, TokenType> {
|
|||
limit,
|
||||
offset,
|
||||
with: {
|
||||
application: true,
|
||||
client: true,
|
||||
...extra?.with,
|
||||
},
|
||||
});
|
||||
|
|
@ -159,7 +159,7 @@ export class Token extends BaseInterface<typeof Tokens, TokenType> {
|
|||
return {
|
||||
access_token: this.data.accessToken,
|
||||
token_type: "Bearer",
|
||||
scope: this.data.scope,
|
||||
scope: this.data.scopes.join(" "),
|
||||
created_at: Math.floor(
|
||||
new Date(this.data.createdAt).getTime() / 1000,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue