chore: auto-generate protobuf files [skip ci]
This commit is contained in:
360
gen/sso/account.ts
Normal file
360
gen/sso/account.ts
Normal file
@@ -0,0 +1,360 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.6
|
||||
// protoc v3.21.12
|
||||
// source: sso/account.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import type { Metadata } from "@grpc/grpc-js";
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
export const protobufPackage = "account.v1";
|
||||
|
||||
export interface GetAccountRequest {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface GetAccountResponse {
|
||||
id: string;
|
||||
username: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
fullName: string;
|
||||
isLdap: boolean;
|
||||
status: string;
|
||||
roles: string[];
|
||||
avatarUrl: string;
|
||||
employeeId?: string | undefined;
|
||||
presence: string;
|
||||
lastActive: string;
|
||||
customStatusText: string;
|
||||
customStatusEmoji: string;
|
||||
timezone: string;
|
||||
language: string;
|
||||
twoFaEnabled: boolean;
|
||||
hasPin: boolean;
|
||||
}
|
||||
|
||||
export interface ChangePasswordRequest {
|
||||
userId: string;
|
||||
oldPassword: string;
|
||||
newPassword: string;
|
||||
code?: string | undefined;
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
export interface ChangePasswordResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface CreateUserRequest {
|
||||
username: string;
|
||||
password: string;
|
||||
roles: string[];
|
||||
}
|
||||
|
||||
export interface CreateUserResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface DeleteUserRequest {
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface DeleteUserResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface ChangeDataRequest {
|
||||
userId: string;
|
||||
sessionId: string;
|
||||
email?: string | undefined;
|
||||
phone?: string | undefined;
|
||||
fullName?: string | undefined;
|
||||
avatarUrl?: string | undefined;
|
||||
customStatusText?: string | undefined;
|
||||
customStatusEmoji?: string | undefined;
|
||||
timezone?: string | undefined;
|
||||
language?: string | undefined;
|
||||
isPublic?: boolean | undefined;
|
||||
}
|
||||
|
||||
export interface ChangeDataResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface AssignRoleRequest {
|
||||
userId: string;
|
||||
/** В gRPC передаем как string, внутри преобразуем в Int */
|
||||
roleId: string;
|
||||
}
|
||||
|
||||
export interface AssignRoleResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface RevokeRoleRequest {
|
||||
userId: string;
|
||||
roleId: string;
|
||||
}
|
||||
|
||||
export interface RevokeRoleResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface AdminResetPasswordRequest {
|
||||
userId: string;
|
||||
newPassword: string;
|
||||
}
|
||||
|
||||
export interface AdminResetPasswordResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface SetPinRequest {
|
||||
userId: string;
|
||||
sessionId: string;
|
||||
pin: string;
|
||||
}
|
||||
|
||||
export interface SetPinResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface UnlockPinRequest {
|
||||
userId: string;
|
||||
sessionId: string;
|
||||
pin: string;
|
||||
}
|
||||
|
||||
export interface UnlockPinResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface GetPinStatusRequest {
|
||||
userId: string;
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
export interface GetPinStatusResponse {
|
||||
hasPin: boolean;
|
||||
isLocked: boolean;
|
||||
lockUntil: string;
|
||||
}
|
||||
|
||||
export interface RemovePinRequest {
|
||||
pin: string;
|
||||
userId: string;
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
export interface RemovePinResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface BlockUserRequest {
|
||||
/** Кого блокируем */
|
||||
userId: string;
|
||||
/** Кто блокирует */
|
||||
adminId: string;
|
||||
reason?: string | undefined;
|
||||
}
|
||||
|
||||
export interface BlockUserResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface UnblockUserRequest {
|
||||
userId: string;
|
||||
adminId: string;
|
||||
}
|
||||
|
||||
export interface UnblockUserResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface BlockIpRequest {
|
||||
ipAddress: string;
|
||||
adminId: string;
|
||||
reason?: string | undefined;
|
||||
}
|
||||
|
||||
export interface BlockIpResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface UnblockIpRequest {
|
||||
ipAddress: string;
|
||||
adminId: string;
|
||||
}
|
||||
|
||||
export interface UnblockIpResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
|
||||
|
||||
export interface AccountServiceClient {
|
||||
getAccount(request: GetAccountRequest, metadata?: Metadata): Observable<GetAccountResponse>;
|
||||
|
||||
changePassword(request: ChangePasswordRequest, metadata?: Metadata): Observable<ChangePasswordResponse>;
|
||||
|
||||
adminResetPassword(request: AdminResetPasswordRequest, metadata?: Metadata): Observable<AdminResetPasswordResponse>;
|
||||
|
||||
createUser(request: CreateUserRequest, metadata?: Metadata): Observable<CreateUserResponse>;
|
||||
|
||||
deleteUser(request: DeleteUserRequest, metadata?: Metadata): Observable<DeleteUserResponse>;
|
||||
|
||||
changeData(request: ChangeDataRequest, metadata?: Metadata): Observable<ChangeDataResponse>;
|
||||
|
||||
assignRole(request: AssignRoleRequest, metadata?: Metadata): Observable<AssignRoleResponse>;
|
||||
|
||||
revokeRole(request: RevokeRoleRequest, metadata?: Metadata): Observable<RevokeRoleResponse>;
|
||||
|
||||
setPin(request: SetPinRequest, metadata?: Metadata): Observable<SetPinResponse>;
|
||||
|
||||
unlockPin(request: UnlockPinRequest, metadata?: Metadata): Observable<UnlockPinResponse>;
|
||||
|
||||
getPinStatus(request: GetPinStatusRequest, metadata?: Metadata): Observable<GetPinStatusResponse>;
|
||||
|
||||
removePin(request: RemovePinRequest, metadata?: Metadata): Observable<RemovePinResponse>;
|
||||
|
||||
blockUser(request: BlockUserRequest, metadata?: Metadata): Observable<BlockUserResponse>;
|
||||
|
||||
unblockUser(request: UnblockUserRequest, metadata?: Metadata): Observable<UnblockUserResponse>;
|
||||
|
||||
blockIp(request: BlockIpRequest, metadata?: Metadata): Observable<BlockIpResponse>;
|
||||
|
||||
unblockIp(request: UnblockIpRequest, metadata?: Metadata): Observable<UnblockIpResponse>;
|
||||
}
|
||||
|
||||
export interface AccountServiceController {
|
||||
getAccount(
|
||||
request: GetAccountRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
|
||||
|
||||
changePassword(
|
||||
request: ChangePasswordRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<ChangePasswordResponse> | Observable<ChangePasswordResponse> | ChangePasswordResponse;
|
||||
|
||||
adminResetPassword(
|
||||
request: AdminResetPasswordRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<AdminResetPasswordResponse> | Observable<AdminResetPasswordResponse> | AdminResetPasswordResponse;
|
||||
|
||||
createUser(
|
||||
request: CreateUserRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
|
||||
|
||||
deleteUser(
|
||||
request: DeleteUserRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<DeleteUserResponse> | Observable<DeleteUserResponse> | DeleteUserResponse;
|
||||
|
||||
changeData(
|
||||
request: ChangeDataRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<ChangeDataResponse> | Observable<ChangeDataResponse> | ChangeDataResponse;
|
||||
|
||||
assignRole(
|
||||
request: AssignRoleRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<AssignRoleResponse> | Observable<AssignRoleResponse> | AssignRoleResponse;
|
||||
|
||||
revokeRole(
|
||||
request: RevokeRoleRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<RevokeRoleResponse> | Observable<RevokeRoleResponse> | RevokeRoleResponse;
|
||||
|
||||
setPin(
|
||||
request: SetPinRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<SetPinResponse> | Observable<SetPinResponse> | SetPinResponse;
|
||||
|
||||
unlockPin(
|
||||
request: UnlockPinRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<UnlockPinResponse> | Observable<UnlockPinResponse> | UnlockPinResponse;
|
||||
|
||||
getPinStatus(
|
||||
request: GetPinStatusRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<GetPinStatusResponse> | Observable<GetPinStatusResponse> | GetPinStatusResponse;
|
||||
|
||||
removePin(
|
||||
request: RemovePinRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<RemovePinResponse> | Observable<RemovePinResponse> | RemovePinResponse;
|
||||
|
||||
blockUser(
|
||||
request: BlockUserRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<BlockUserResponse> | Observable<BlockUserResponse> | BlockUserResponse;
|
||||
|
||||
unblockUser(
|
||||
request: UnblockUserRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<UnblockUserResponse> | Observable<UnblockUserResponse> | UnblockUserResponse;
|
||||
|
||||
blockIp(
|
||||
request: BlockIpRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<BlockIpResponse> | Observable<BlockIpResponse> | BlockIpResponse;
|
||||
|
||||
unblockIp(
|
||||
request: UnblockIpRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<UnblockIpResponse> | Observable<UnblockIpResponse> | UnblockIpResponse;
|
||||
}
|
||||
|
||||
export function AccountServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = [
|
||||
"getAccount",
|
||||
"changePassword",
|
||||
"adminResetPassword",
|
||||
"createUser",
|
||||
"deleteUser",
|
||||
"changeData",
|
||||
"assignRole",
|
||||
"revokeRole",
|
||||
"setPin",
|
||||
"unlockPin",
|
||||
"getPinStatus",
|
||||
"removePin",
|
||||
"blockUser",
|
||||
"unblockUser",
|
||||
"blockIp",
|
||||
"unblockIp",
|
||||
];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const ACCOUNT_SERVICE_NAME = "AccountService";
|
||||
189
gen/sso/auth.ts
Normal file
189
gen/sso/auth.ts
Normal file
@@ -0,0 +1,189 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.6
|
||||
// protoc v3.21.12
|
||||
// source: sso/auth.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import type { Metadata } from "@grpc/grpc-js";
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
export const protobufPackage = "auth.v1";
|
||||
|
||||
export interface LoginRequest {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
status: string;
|
||||
need2fa: boolean;
|
||||
tempToken?: string | undefined;
|
||||
message?: string | undefined;
|
||||
errorCode?: string | undefined;
|
||||
}
|
||||
|
||||
export interface RefreshRequest {
|
||||
refreshToken: string;
|
||||
}
|
||||
|
||||
export interface RefreshResponse {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
}
|
||||
|
||||
export interface LogoutRequest {
|
||||
userId: string;
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
export interface LogoutResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface VerifyTokenRequest {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface VerifyTokenResponse {
|
||||
isValid: boolean;
|
||||
errorMessage?: string | undefined;
|
||||
id?: string | undefined;
|
||||
username?: string | undefined;
|
||||
roleLevel?: number | undefined;
|
||||
permissions: string[];
|
||||
sessionId?: string | undefined;
|
||||
requiresPin?: boolean | undefined;
|
||||
}
|
||||
|
||||
export interface GetAccountRoleLevelRequest {
|
||||
accountId: string;
|
||||
}
|
||||
|
||||
export interface GetAccountRoleLevelResponse {
|
||||
found: boolean;
|
||||
roleLevel: number;
|
||||
}
|
||||
|
||||
export interface GetSessionRequest {
|
||||
userId: string;
|
||||
currentSessionId: string;
|
||||
}
|
||||
|
||||
export interface SessionItem {
|
||||
/** Здесь будет лежать захэшированный ID */
|
||||
id: string;
|
||||
ipAddress: string;
|
||||
userAgent: string;
|
||||
/** Unix timestamp в миллисекундах */
|
||||
lastActivity: number;
|
||||
/** Флаг текущей сессии */
|
||||
isCurrent: boolean;
|
||||
}
|
||||
|
||||
export interface GetSessionsResponse {
|
||||
sessions: SessionItem[];
|
||||
}
|
||||
|
||||
export interface TerminateSessionRequest {
|
||||
userId: string;
|
||||
/** Хэш сессии, которую нужно убить */
|
||||
targetHash: string;
|
||||
}
|
||||
|
||||
export interface TerminateSessionResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
||||
|
||||
export interface AuthServiceClient {
|
||||
login(request: LoginRequest, metadata?: Metadata): Observable<LoginResponse>;
|
||||
|
||||
refresh(request: RefreshRequest, metadata?: Metadata): Observable<RefreshResponse>;
|
||||
|
||||
verifyToken(request: VerifyTokenRequest, metadata?: Metadata): Observable<VerifyTokenResponse>;
|
||||
|
||||
getAccountRoleLevel(
|
||||
request: GetAccountRoleLevelRequest,
|
||||
metadata?: Metadata,
|
||||
): Observable<GetAccountRoleLevelResponse>;
|
||||
|
||||
logout(request: LogoutRequest, metadata?: Metadata): Observable<LogoutResponse>;
|
||||
|
||||
logoutOther(request: LogoutRequest, metadata?: Metadata): Observable<LogoutResponse>;
|
||||
|
||||
getSessions(request: GetSessionRequest, metadata?: Metadata): Observable<GetSessionsResponse>;
|
||||
|
||||
terminateSession(request: TerminateSessionRequest, metadata?: Metadata): Observable<TerminateSessionResponse>;
|
||||
}
|
||||
|
||||
export interface AuthServiceController {
|
||||
login(request: LoginRequest, metadata?: Metadata): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
|
||||
|
||||
refresh(
|
||||
request: RefreshRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
||||
|
||||
verifyToken(
|
||||
request: VerifyTokenRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<VerifyTokenResponse> | Observable<VerifyTokenResponse> | VerifyTokenResponse;
|
||||
|
||||
getAccountRoleLevel(
|
||||
request: GetAccountRoleLevelRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<GetAccountRoleLevelResponse> | Observable<GetAccountRoleLevelResponse> | GetAccountRoleLevelResponse;
|
||||
|
||||
logout(
|
||||
request: LogoutRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
||||
|
||||
logoutOther(
|
||||
request: LogoutRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
||||
|
||||
getSessions(
|
||||
request: GetSessionRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<GetSessionsResponse> | Observable<GetSessionsResponse> | GetSessionsResponse;
|
||||
|
||||
terminateSession(
|
||||
request: TerminateSessionRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<TerminateSessionResponse> | Observable<TerminateSessionResponse> | TerminateSessionResponse;
|
||||
}
|
||||
|
||||
export function AuthServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = [
|
||||
"login",
|
||||
"refresh",
|
||||
"verifyToken",
|
||||
"getAccountRoleLevel",
|
||||
"logout",
|
||||
"logoutOther",
|
||||
"getSessions",
|
||||
"terminateSession",
|
||||
];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const AUTH_SERVICE_NAME = "AuthService";
|
||||
56
gen/sso/ldap-auth.ts
Normal file
56
gen/sso/ldap-auth.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.6
|
||||
// protoc v3.21.12
|
||||
// source: sso/ldap-auth.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import type { Metadata } from "@grpc/grpc-js";
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
import { UserData } from "./ldap";
|
||||
|
||||
export const protobufPackage = "ldap_auth.v1";
|
||||
|
||||
/** --- Авторизация --- */
|
||||
export interface VerifyRequest {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface VerifyResponse {
|
||||
success: boolean;
|
||||
errorMessage: string;
|
||||
/** Отдаем полные данные при успешном входе */
|
||||
user: UserData | undefined;
|
||||
}
|
||||
|
||||
export const LDAP_AUTH_V1_PACKAGE_NAME = "ldap_auth.v1";
|
||||
|
||||
export interface LdapAuthServiceClient {
|
||||
verifyUser(request: VerifyRequest, metadata?: Metadata): Observable<VerifyResponse>;
|
||||
}
|
||||
|
||||
export interface LdapAuthServiceController {
|
||||
verifyUser(
|
||||
request: VerifyRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<VerifyResponse> | Observable<VerifyResponse> | VerifyResponse;
|
||||
}
|
||||
|
||||
export function LdapAuthServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = ["verifyUser"];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("LdapAuthService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("LdapAuthService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const LDAP_AUTH_SERVICE_NAME = "LdapAuthService";
|
||||
211
gen/sso/ldap.ts
Normal file
211
gen/sso/ldap.ts
Normal file
@@ -0,0 +1,211 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.6
|
||||
// protoc v3.21.12
|
||||
// source: sso/ldap.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import type { Metadata } from "@grpc/grpc-js";
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
export const protobufPackage = "ldap.v1";
|
||||
|
||||
/**
|
||||
* ==========================================
|
||||
* БАЗОВЫЕ И ПЕРЕИСПОЛЬЗУЕМЫЕ СТРУКТУРЫ
|
||||
* ==========================================
|
||||
*/
|
||||
export interface EmptyRequest {
|
||||
}
|
||||
|
||||
/** Стандартный ответ для мутаций (создание, обновление, удаление) */
|
||||
export interface StatusResponse {
|
||||
success: boolean;
|
||||
errorMessage: string;
|
||||
}
|
||||
|
||||
/** Полная модель пользователя */
|
||||
export interface UserData {
|
||||
/** Полный путь в AD (Distinguished Name) */
|
||||
dn: string;
|
||||
/** Логин (sAMAccountName) */
|
||||
username: string;
|
||||
/** ФИО (displayName) */
|
||||
displayName: string;
|
||||
/** Почта (mail) */
|
||||
email: string;
|
||||
/** Описание/Должность (description) */
|
||||
description: string;
|
||||
/** Аватарка в байтах (thumbnailPhoto) */
|
||||
avatar: Uint8Array;
|
||||
/** Список групп */
|
||||
groups: string[];
|
||||
/** Статус аккаунта */
|
||||
isActive: boolean;
|
||||
phone: string;
|
||||
}
|
||||
|
||||
/** Модель группы */
|
||||
export interface GroupData {
|
||||
dn: string;
|
||||
/** Короткое имя группы (cn) */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** --- Списки --- */
|
||||
export interface UserListResponse {
|
||||
success: boolean;
|
||||
errorMessage: string;
|
||||
users: UserData[];
|
||||
}
|
||||
|
||||
export interface GroupListResponse {
|
||||
success: boolean;
|
||||
errorMessage: string;
|
||||
groups: GroupData[];
|
||||
}
|
||||
|
||||
/** --- Управление профилем --- */
|
||||
export interface CreateUserRequest {
|
||||
username: string;
|
||||
fullName: string;
|
||||
password: string;
|
||||
/** Сразу при создании можно задать почту */
|
||||
email?: string | undefined;
|
||||
}
|
||||
|
||||
/** Запрос на обновление. Используем optional для частичного обновления. */
|
||||
export interface UpdateUserRequest {
|
||||
/** Обязательное поле: кого обновляем */
|
||||
username: string;
|
||||
/** Новое ФИО (повлечет Rename CN) */
|
||||
displayName?:
|
||||
| string
|
||||
| undefined;
|
||||
/** Новая почта */
|
||||
email?:
|
||||
| string
|
||||
| undefined;
|
||||
/** Новое описание */
|
||||
description?:
|
||||
| string
|
||||
| undefined;
|
||||
/** Новая аватарка (бинарник картинки) */
|
||||
avatar?: Uint8Array | undefined;
|
||||
}
|
||||
|
||||
export interface ChangePasswordRequest {
|
||||
username: string;
|
||||
newPassword: string;
|
||||
}
|
||||
|
||||
export interface ToggleStatusRequest {
|
||||
username: string;
|
||||
/** true - включить (512), false - отключить (514) */
|
||||
setActive: boolean;
|
||||
}
|
||||
|
||||
/** --- Управление членством в группах --- */
|
||||
export interface GroupMemberRequest {
|
||||
/** Логин пользователя */
|
||||
username: string;
|
||||
/** Полный путь группы (в которую добавляем / из которой удаляем) */
|
||||
groupDn: string;
|
||||
}
|
||||
|
||||
export const LDAP_V1_PACKAGE_NAME = "ldap.v1";
|
||||
|
||||
export interface LdapServiceClient {
|
||||
/** Управление Пользователями (Bind системного аккаунта) --- */
|
||||
|
||||
getUsers(request: EmptyRequest, metadata?: Metadata): Observable<UserListResponse>;
|
||||
|
||||
createUser(request: CreateUserRequest, metadata?: Metadata): Observable<StatusResponse>;
|
||||
|
||||
updateUser(request: UpdateUserRequest, metadata?: Metadata): Observable<StatusResponse>;
|
||||
|
||||
changePassword(request: ChangePasswordRequest, metadata?: Metadata): Observable<StatusResponse>;
|
||||
|
||||
toggleUserStatus(request: ToggleStatusRequest, metadata?: Metadata): Observable<StatusResponse>;
|
||||
|
||||
/** Управление Группами --- */
|
||||
|
||||
getGroups(request: EmptyRequest, metadata?: Metadata): Observable<GroupListResponse>;
|
||||
|
||||
addUserToGroup(request: GroupMemberRequest, metadata?: Metadata): Observable<StatusResponse>;
|
||||
|
||||
removeUserFromGroup(request: GroupMemberRequest, metadata?: Metadata): Observable<StatusResponse>;
|
||||
}
|
||||
|
||||
export interface LdapServiceController {
|
||||
/** Управление Пользователями (Bind системного аккаунта) --- */
|
||||
|
||||
getUsers(
|
||||
request: EmptyRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<UserListResponse> | Observable<UserListResponse> | UserListResponse;
|
||||
|
||||
createUser(
|
||||
request: CreateUserRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
||||
|
||||
updateUser(
|
||||
request: UpdateUserRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
||||
|
||||
changePassword(
|
||||
request: ChangePasswordRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
||||
|
||||
toggleUserStatus(
|
||||
request: ToggleStatusRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
||||
|
||||
/** Управление Группами --- */
|
||||
|
||||
getGroups(
|
||||
request: EmptyRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<GroupListResponse> | Observable<GroupListResponse> | GroupListResponse;
|
||||
|
||||
addUserToGroup(
|
||||
request: GroupMemberRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
||||
|
||||
removeUserFromGroup(
|
||||
request: GroupMemberRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<StatusResponse> | Observable<StatusResponse> | StatusResponse;
|
||||
}
|
||||
|
||||
export function LdapServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = [
|
||||
"getUsers",
|
||||
"createUser",
|
||||
"updateUser",
|
||||
"changePassword",
|
||||
"toggleUserStatus",
|
||||
"getGroups",
|
||||
"addUserToGroup",
|
||||
"removeUserFromGroup",
|
||||
];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("LdapService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("LdapService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const LDAP_SERVICE_NAME = "LdapService";
|
||||
172
gen/sso/rbac.ts
Normal file
172
gen/sso/rbac.ts
Normal file
@@ -0,0 +1,172 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.6
|
||||
// protoc v3.21.12
|
||||
// source: sso/rbac.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import type { Metadata } from "@grpc/grpc-js";
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
export const protobufPackage = "rbac.v1";
|
||||
|
||||
export interface GetAllPermissionsRequest {
|
||||
userId: string;
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
export interface GetAllPermissionsResponse {
|
||||
permissions: Permission[];
|
||||
}
|
||||
|
||||
export interface Permission {
|
||||
id: string;
|
||||
code: string;
|
||||
description: string;
|
||||
module: string;
|
||||
roles: string[];
|
||||
}
|
||||
|
||||
export interface GetAllRolesRequest {
|
||||
userId: string;
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
export interface GetAllRolesResponse {
|
||||
roles: Roles[];
|
||||
}
|
||||
|
||||
export interface CreateRoleRequest {
|
||||
name: string;
|
||||
level: number;
|
||||
permissionCodes: string[];
|
||||
}
|
||||
|
||||
export interface UpdateRoleRequest {
|
||||
id: string;
|
||||
name?: string | undefined;
|
||||
level?: number | undefined;
|
||||
permissionCodes: string[];
|
||||
}
|
||||
|
||||
export interface ModifyRoleResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface DeleteRoleRequest {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface DeleteRoleResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
fallbackRoleName?: string | undefined;
|
||||
}
|
||||
|
||||
export interface CreatePermissionRequest {
|
||||
code: string;
|
||||
description: string;
|
||||
module: string;
|
||||
}
|
||||
|
||||
export interface UpdatePermissionRequest {
|
||||
id: string;
|
||||
/** Привязка к конкретным ролям */
|
||||
roleIds: string[];
|
||||
}
|
||||
|
||||
export interface ModifyPermissionResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface Roles {
|
||||
id: string;
|
||||
name: string;
|
||||
level: number;
|
||||
permissions: string[];
|
||||
ldapMapping: string[];
|
||||
accounts: string[];
|
||||
}
|
||||
|
||||
export const RBAC_V1_PACKAGE_NAME = "rbac.v1";
|
||||
|
||||
export interface RbacServiceClient {
|
||||
createRole(request: CreateRoleRequest, metadata?: Metadata): Observable<ModifyRoleResponse>;
|
||||
|
||||
updateRole(request: UpdateRoleRequest, metadata?: Metadata): Observable<ModifyRoleResponse>;
|
||||
|
||||
deleteRole(request: DeleteRoleRequest, metadata?: Metadata): Observable<DeleteRoleResponse>;
|
||||
|
||||
createPermission(request: CreatePermissionRequest, metadata?: Metadata): Observable<ModifyPermissionResponse>;
|
||||
|
||||
updatePermission(request: UpdatePermissionRequest, metadata?: Metadata): Observable<ModifyPermissionResponse>;
|
||||
|
||||
getAllPermissions(request: GetAllPermissionsRequest, metadata?: Metadata): Observable<GetAllPermissionsResponse>;
|
||||
|
||||
getAllRoles(request: GetAllRolesRequest, metadata?: Metadata): Observable<GetAllRolesResponse>;
|
||||
}
|
||||
|
||||
export interface RbacServiceController {
|
||||
createRole(
|
||||
request: CreateRoleRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<ModifyRoleResponse> | Observable<ModifyRoleResponse> | ModifyRoleResponse;
|
||||
|
||||
updateRole(
|
||||
request: UpdateRoleRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<ModifyRoleResponse> | Observable<ModifyRoleResponse> | ModifyRoleResponse;
|
||||
|
||||
deleteRole(
|
||||
request: DeleteRoleRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<DeleteRoleResponse> | Observable<DeleteRoleResponse> | DeleteRoleResponse;
|
||||
|
||||
createPermission(
|
||||
request: CreatePermissionRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<ModifyPermissionResponse> | Observable<ModifyPermissionResponse> | ModifyPermissionResponse;
|
||||
|
||||
updatePermission(
|
||||
request: UpdatePermissionRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<ModifyPermissionResponse> | Observable<ModifyPermissionResponse> | ModifyPermissionResponse;
|
||||
|
||||
getAllPermissions(
|
||||
request: GetAllPermissionsRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<GetAllPermissionsResponse> | Observable<GetAllPermissionsResponse> | GetAllPermissionsResponse;
|
||||
|
||||
getAllRoles(
|
||||
request: GetAllRolesRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<GetAllRolesResponse> | Observable<GetAllRolesResponse> | GetAllRolesResponse;
|
||||
}
|
||||
|
||||
export function RbacServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = [
|
||||
"createRole",
|
||||
"updateRole",
|
||||
"deleteRole",
|
||||
"createPermission",
|
||||
"updatePermission",
|
||||
"getAllPermissions",
|
||||
"getAllRoles",
|
||||
];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("RbacService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("RbacService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const RBAC_SERVICE_NAME = "RbacService";
|
||||
221
gen/sso/twofa.ts
Normal file
221
gen/sso/twofa.ts
Normal file
@@ -0,0 +1,221 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.6
|
||||
// protoc v3.21.12
|
||||
// source: sso/twofa.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import type { Metadata } from "@grpc/grpc-js";
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
export const protobufPackage = "twofa.v1";
|
||||
|
||||
export interface Verify2FaRequest {
|
||||
tempToken: string;
|
||||
totpCode?: string | undefined;
|
||||
telegramCode?: string | undefined;
|
||||
}
|
||||
|
||||
export interface Verify2FaResponse {
|
||||
accessToken: string;
|
||||
status: string;
|
||||
message: string;
|
||||
reserveCodes: string[];
|
||||
}
|
||||
|
||||
export interface AuthenticatedAccessRequest {
|
||||
accessToken: string;
|
||||
}
|
||||
|
||||
export interface GetTwoFaStatusRequest {
|
||||
accessToken: string;
|
||||
}
|
||||
|
||||
export interface GetTwoFaStatusResponse {
|
||||
totpEnabled: boolean;
|
||||
telegramEnabled: boolean;
|
||||
totpEnrollmentPending: boolean;
|
||||
telegramEnrollmentPending: boolean;
|
||||
}
|
||||
|
||||
export interface StartTotpEnrollmentResponse {
|
||||
secretBase32: string;
|
||||
otpauthUri: string;
|
||||
issuer: string;
|
||||
accountLabel: string;
|
||||
}
|
||||
|
||||
export interface ConfirmTotpEnrollmentRequest {
|
||||
accessToken: string;
|
||||
totpCode: string;
|
||||
}
|
||||
|
||||
export interface ConfirmTotpEnrollmentResponse {
|
||||
status: string;
|
||||
message: string;
|
||||
reserveCodes: string[];
|
||||
}
|
||||
|
||||
export interface CancelTotpEnrollmentResponse {
|
||||
status: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface DisableTotpRequest {
|
||||
accessToken: string;
|
||||
password: string;
|
||||
totpCode?: string | undefined;
|
||||
}
|
||||
|
||||
export interface DisableTotpResponse {
|
||||
status: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface StartTelegramEnrollmentResponse {
|
||||
enrollmentToken: string;
|
||||
deepLink: string;
|
||||
botUsername: string;
|
||||
expiresAtIso: string;
|
||||
}
|
||||
|
||||
export interface ConfirmTelegramEnrollmentRequest {
|
||||
accessToken: string;
|
||||
enrollmentToken: string;
|
||||
otpCode: string;
|
||||
}
|
||||
|
||||
export interface ConfirmTelegramEnrollmentResponse {
|
||||
status: string;
|
||||
message: string;
|
||||
reserveCodes: string[];
|
||||
}
|
||||
|
||||
export interface DisableTelegramRequest {
|
||||
accessToken: string;
|
||||
password: string;
|
||||
telegramOtpCode?: string | undefined;
|
||||
}
|
||||
|
||||
export interface DisableTelegramResponse {
|
||||
status: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export const TWOFA_V1_PACKAGE_NAME = "twofa.v1";
|
||||
|
||||
export interface TwoFaServiceClient {
|
||||
verify2Fa(request: Verify2FaRequest, metadata?: Metadata): Observable<Verify2FaResponse>;
|
||||
|
||||
getTwoFaStatus(request: GetTwoFaStatusRequest, metadata?: Metadata): Observable<GetTwoFaStatusResponse>;
|
||||
|
||||
startTotpEnrollment(
|
||||
request: AuthenticatedAccessRequest,
|
||||
metadata?: Metadata,
|
||||
): Observable<StartTotpEnrollmentResponse>;
|
||||
|
||||
confirmTotpErollment(
|
||||
request: ConfirmTotpEnrollmentRequest,
|
||||
metadata?: Metadata,
|
||||
): Observable<ConfirmTotpEnrollmentResponse>;
|
||||
|
||||
cancelTotpEnrollment(
|
||||
request: AuthenticatedAccessRequest,
|
||||
metadata?: Metadata,
|
||||
): Observable<CancelTotpEnrollmentResponse>;
|
||||
|
||||
disableTotp(request: DisableTotpRequest, metadata?: Metadata): Observable<DisableTotpResponse>;
|
||||
|
||||
startTelegramEnrollment(
|
||||
request: AuthenticatedAccessRequest,
|
||||
metadata?: Metadata,
|
||||
): Observable<StartTelegramEnrollmentResponse>;
|
||||
|
||||
confirmTelegramEnrollment(
|
||||
request: ConfirmTelegramEnrollmentRequest,
|
||||
metadata?: Metadata,
|
||||
): Observable<ConfirmTelegramEnrollmentResponse>;
|
||||
|
||||
disableTelegram(request: DisableTelegramRequest, metadata?: Metadata): Observable<DisableTelegramResponse>;
|
||||
}
|
||||
|
||||
export interface TwoFaServiceController {
|
||||
verify2Fa(
|
||||
request: Verify2FaRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<Verify2FaResponse> | Observable<Verify2FaResponse> | Verify2FaResponse;
|
||||
|
||||
getTwoFaStatus(
|
||||
request: GetTwoFaStatusRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<GetTwoFaStatusResponse> | Observable<GetTwoFaStatusResponse> | GetTwoFaStatusResponse;
|
||||
|
||||
startTotpEnrollment(
|
||||
request: AuthenticatedAccessRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<StartTotpEnrollmentResponse> | Observable<StartTotpEnrollmentResponse> | StartTotpEnrollmentResponse;
|
||||
|
||||
confirmTotpErollment(
|
||||
request: ConfirmTotpEnrollmentRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<ConfirmTotpEnrollmentResponse> | Observable<ConfirmTotpEnrollmentResponse> | ConfirmTotpEnrollmentResponse;
|
||||
|
||||
cancelTotpEnrollment(
|
||||
request: AuthenticatedAccessRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<CancelTotpEnrollmentResponse> | Observable<CancelTotpEnrollmentResponse> | CancelTotpEnrollmentResponse;
|
||||
|
||||
disableTotp(
|
||||
request: DisableTotpRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<DisableTotpResponse> | Observable<DisableTotpResponse> | DisableTotpResponse;
|
||||
|
||||
startTelegramEnrollment(
|
||||
request: AuthenticatedAccessRequest,
|
||||
metadata?: Metadata,
|
||||
):
|
||||
| Promise<StartTelegramEnrollmentResponse>
|
||||
| Observable<StartTelegramEnrollmentResponse>
|
||||
| StartTelegramEnrollmentResponse;
|
||||
|
||||
confirmTelegramEnrollment(
|
||||
request: ConfirmTelegramEnrollmentRequest,
|
||||
metadata?: Metadata,
|
||||
):
|
||||
| Promise<ConfirmTelegramEnrollmentResponse>
|
||||
| Observable<ConfirmTelegramEnrollmentResponse>
|
||||
| ConfirmTelegramEnrollmentResponse;
|
||||
|
||||
disableTelegram(
|
||||
request: DisableTelegramRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<DisableTelegramResponse> | Observable<DisableTelegramResponse> | DisableTelegramResponse;
|
||||
}
|
||||
|
||||
export function TwoFaServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = [
|
||||
"verify2Fa",
|
||||
"getTwoFaStatus",
|
||||
"startTotpEnrollment",
|
||||
"confirmTotpErollment",
|
||||
"cancelTotpEnrollment",
|
||||
"disableTotp",
|
||||
"startTelegramEnrollment",
|
||||
"confirmTelegramEnrollment",
|
||||
"disableTelegram",
|
||||
];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("TwoFaService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("TwoFaService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const TWO_FA_SERVICE_NAME = "TwoFaService";
|
||||
Reference in New Issue
Block a user