updated api web service
This commit is contained in:
parent
537d70a8f3
commit
e0de2ed251
5 changed files with 84 additions and 3 deletions
|
|
@ -3,6 +3,7 @@ import { createDecoder, createVerifier } from "fast-jwt";
|
|||
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
import { handleWebServiceAuth } from "./authWebService";
|
||||
|
||||
if (!process.env.AUTH_PUBLIC_KEY && !process.env.AUTH_REALM_URL) {
|
||||
throw new Error("Require keycloak AUTH_PUBLIC_KEY or AUTH_REALM_URL.");
|
||||
|
|
@ -30,6 +31,11 @@ export async function expressAuthentication(
|
|||
return { preferred_username: "bypassed" };
|
||||
}
|
||||
|
||||
// เพิ่มการจัดการสำหรับ Web Service Authentication
|
||||
if (securityName === "webServiceAuth") {
|
||||
return await handleWebServiceAuth(request);
|
||||
}
|
||||
|
||||
if (securityName !== "bearerAuth") throw new Error("ไม่ทราบวิธีการยืนยันตัวตน");
|
||||
|
||||
const token = request.headers["authorization"]?.includes("Bearer ")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue