Added auto database creation based on sql scripts and jwt key cache
This commit is contained in:
+10
-1
@@ -7,6 +7,7 @@ import {
|
||||
} from "@melvdouc/xml-parser";
|
||||
import { createJwt } from "@popov/jwt";
|
||||
import { setCookie } from "$std/http/cookie.ts";
|
||||
import { getKey } from "$root/routes/_middleware.ts";
|
||||
|
||||
const SERVICE = "https://localhost/login";
|
||||
const CAS = "https://ident.univ-amu.fr/cas";
|
||||
@@ -23,6 +24,14 @@ interface CasResponse extends RegularTagNode {
|
||||
children: [TextNode, CasGroupNode];
|
||||
}
|
||||
|
||||
export interface LoginJWT {
|
||||
iss: "PolyMPR";
|
||||
iat: number;
|
||||
exp: number;
|
||||
aud: "PolyMPR";
|
||||
user: Record<string, string | string[]>;
|
||||
}
|
||||
|
||||
function getTag(tag: CasTagNode): [string, string] {
|
||||
return [
|
||||
tag.tagName.replace("cas:", ""),
|
||||
@@ -55,7 +64,7 @@ function createUserJWT(casResponse: CasResponse): Promise<string> {
|
||||
user: fullUserInfos,
|
||||
};
|
||||
|
||||
const key = "NEED TO CHANGE THIS KEY FURTHER IN DEV";
|
||||
const key = getKey(fullUserInfos.uid as string);
|
||||
return createJwt(payload, key);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user