Use Azure auth for no good reason

This commit is contained in:
2025-03-26 19:42:26 +01:00
parent 52933e617a
commit cec7d47c9e
17 changed files with 635 additions and 615 deletions

View File

@@ -2,6 +2,27 @@ import * as Common from "common";
import * as Function from "common/Function";
import { t } from "elysia";
export interface AccessTokenPayload {
readonly aud: string;
readonly iss: string;
readonly iat: number;
readonly nbf: number;
readonly exp: number;
readonly name: string;
readonly oid: Common.UserId;
}
export interface IdTokenPayload {
readonly aud: string;
readonly iss: string;
readonly iat: number;
readonly nbf: number;
readonly exp: number;
readonly name: string;
readonly oid: Common.UserId;
readonly roles: readonly string[];
}
const brandedString = <T>() => t.Transform(t.String())
.Decode(Function.unsafeCoerce<string, T>)
.Encode(Function.unsafeCoerce<T, string>);
@@ -44,6 +65,12 @@ export const Attachment = t.Object({
...SystemInformation,
});
export const Me = t.Object({
userId: UserId,
username: t.String(),
roles: t.Array(t.String()),
});
export const Piece = t.Object({
pieceId: PieceId,
name: t.String({ minLength: 1 }),
@@ -81,35 +108,15 @@ export const Repertoire_Query = t.Object({
export const User = t.Object({
userId: UserId,
username: t.String(),
admin: t.Boolean(),
});
export const User_Patch = t.Object({
username: t.Optional(t.String()),
password: t.Optional(t.String({ minLength: 8 })),
admin: t.Optional(t.Boolean()),
});
export const User_Post = t.Object({
username: t.String(),
password: t.String({ minLength: 8 }),
admin: t.Boolean(),
});
export const User_Query = t.Object({
username: t.Optional(t.String()),
...Pagination,
displayName: t.String(),
});
export type AccessLog = typeof AccessLog.static;
export type Attachment = typeof Attachment.static;
export type Me = typeof Me.static;
export type Piece = typeof Piece.static;
export type Piece_Post = typeof Piece_Post.static;
export type Piece_Query = typeof Piece_Query.static;
export type Repertoire = typeof Repertoire.static;
export type Repertoire_Query = typeof Repertoire_Query.static;
export type User = typeof User.static;
export type User_Patch = typeof User_Patch.static;
export type User_Post = typeof User_Post.static;
export type User_Query = typeof User_Query.static;