refactor(keycloak): now only expose role management endpoint
This commit is contained in:
parent
2dd6a48793
commit
0ad16eb363
1 changed files with 2 additions and 33 deletions
|
|
@ -1,41 +1,10 @@
|
||||||
import { Body, Controller, Delete, Get, Path, Post, Put, Route, Security, Tags } from "tsoa";
|
import { Body, Controller, Delete, Get, Path, Post, Route, Security, Tags } from "tsoa";
|
||||||
import {
|
import { addUserRoles, listRole, removeUserRoles } from "../services/keycloak";
|
||||||
addUserRoles,
|
|
||||||
createUser,
|
|
||||||
deleteUser,
|
|
||||||
editUser,
|
|
||||||
listRole,
|
|
||||||
removeUserRoles,
|
|
||||||
} from "../services/keycloak";
|
|
||||||
|
|
||||||
@Route("api/v1/keycloak")
|
@Route("api/v1/keycloak")
|
||||||
@Tags("Single-Sign On")
|
@Tags("Single-Sign On")
|
||||||
@Security("keycloak")
|
@Security("keycloak")
|
||||||
export class KeycloakController extends Controller {
|
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")
|
@Get("role")
|
||||||
async getRole() {
|
async getRole() {
|
||||||
const role = await listRole();
|
const role = await listRole();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue