From 0ad16eb36392d47a9c3f349e8bb22e20f927c0e9 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Tue, 22 Oct 2024 10:41:46 +0700 Subject: [PATCH] refactor(keycloak): now only expose role management endpoint --- src/controllers/00-keycloak-controller.ts | 35 ++--------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/src/controllers/00-keycloak-controller.ts b/src/controllers/00-keycloak-controller.ts index 52eee67..87ca8d0 100644 --- a/src/controllers/00-keycloak-controller.ts +++ b/src/controllers/00-keycloak-controller.ts @@ -1,41 +1,10 @@ -import { Body, Controller, Delete, Get, Path, Post, Put, Route, Security, Tags } from "tsoa"; -import { - addUserRoles, - createUser, - deleteUser, - editUser, - listRole, - removeUserRoles, -} from "../services/keycloak"; +import { Body, Controller, Delete, Get, Path, Post, Route, Security, Tags } from "tsoa"; +import { addUserRoles, listRole, removeUserRoles } from "../services/keycloak"; @Route("api/v1/keycloak") @Tags("Single-Sign On") @Security("keycloak") export class KeycloakController extends Controller { - @Post("user") - async createUser( - @Body() body: { username: string; password: string; firstName?: string; lastName?: string }, - ) { - return await createUser(body.username, body.password, { - firstName: body.firstName, - lastName: body.lastName, - requiredActions: ["UPDATE_PASSWORD"], - }); - } - - @Put("user/{userId}") - async editUser( - @Path() userId: string, - @Body() body: { username?: string; password?: string; firstName?: string; lastName?: string }, - ) { - return await editUser(userId, body); - } - - @Delete("user/{userId}") - async deleteUser(@Path() userId: string) { - return await deleteUser(userId); - } - @Get("role") async getRole() { const role = await listRole();