Use Azure auth for no good reason
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user