198 lines
5.9 KiB
TypeScript
198 lines
5.9 KiB
TypeScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-ts_proto v2.11.8
|
|
// protoc v4.25.9
|
|
// source: sso/oauth.proto
|
|
|
|
/* eslint-disable */
|
|
import type { Metadata } from "@grpc/grpc-js";
|
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
import { Observable } from "rxjs";
|
|
|
|
export const protobufPackage = "oauth.v1";
|
|
|
|
/** --- Сообщения для базового SSO --- */
|
|
export interface GenerateOauthCodeRequest {
|
|
userId: string;
|
|
clientId: string;
|
|
redirectUri: string;
|
|
}
|
|
|
|
export interface GenerateOauthCodeResponse {
|
|
code: string;
|
|
}
|
|
|
|
export interface ExchangeOauthCodeRequest {
|
|
code: string;
|
|
clientId: string;
|
|
clientSecret: string;
|
|
}
|
|
|
|
export interface ExchangeOauthCodeResponse {
|
|
accessToken: string;
|
|
expiresIn: number;
|
|
}
|
|
|
|
/** --- Сообщения для управления клиентами --- */
|
|
export interface CreateOauthClientRequest {
|
|
ownerId: string;
|
|
name: string;
|
|
redirectUris: string[];
|
|
description?: string | undefined;
|
|
}
|
|
|
|
export interface CreateOauthClientResponse {
|
|
id: string;
|
|
name: string;
|
|
clientId: string;
|
|
/** Отдается ТОЛЬКО здесь один раз */
|
|
plainSecret: string;
|
|
redirectUris: string[];
|
|
ownerId: string;
|
|
}
|
|
|
|
export interface GetOauthClientsRequest {
|
|
ownerId: string;
|
|
/** Если true, owner_id игнорируется, выдаются все клиенты */
|
|
isAdmin: boolean;
|
|
limit: number;
|
|
offset: number;
|
|
}
|
|
|
|
export interface OauthClientItem {
|
|
id: string;
|
|
name: string;
|
|
clientId: string;
|
|
redirectUris: string[];
|
|
description?: string | undefined;
|
|
ownerId: string;
|
|
createdAt: number;
|
|
}
|
|
|
|
export interface GetOauthClientsResponse {
|
|
clients: OauthClientItem[];
|
|
total: number;
|
|
}
|
|
|
|
export interface UpdateOauthClientRequest {
|
|
clientId: string;
|
|
/** ID того, кто делает запрос */
|
|
ownerId: string;
|
|
isAdmin: boolean;
|
|
name?: string | undefined;
|
|
redirectUris: string[];
|
|
description?: string | undefined;
|
|
}
|
|
|
|
export interface UpdateOauthClientResponse {
|
|
success: boolean;
|
|
}
|
|
|
|
export interface ResetOauthSecretRequest {
|
|
clientId: string;
|
|
ownerId: string;
|
|
isAdmin: boolean;
|
|
}
|
|
|
|
export interface ResetOauthSecretResponse {
|
|
newPlainSecret: string;
|
|
}
|
|
|
|
export interface DeleteOauthClientRequest {
|
|
clientId: string;
|
|
ownerId: string;
|
|
isAdmin: boolean;
|
|
}
|
|
|
|
export interface DeleteOauthClientResponse {
|
|
success: boolean;
|
|
}
|
|
|
|
export const OAUTH_V1_PACKAGE_NAME = "oauth.v1";
|
|
|
|
export interface OauthServiceClient {
|
|
/** === Базовый SSO (вызывается из Gateway / Графаны) === */
|
|
|
|
generateOauthCode(request: GenerateOauthCodeRequest, metadata?: Metadata): Observable<GenerateOauthCodeResponse>;
|
|
|
|
exchangeOauthCode(request: ExchangeOauthCodeRequest, metadata?: Metadata): Observable<ExchangeOauthCodeResponse>;
|
|
|
|
/** === Системные методы (Консоль Разработчика / Админка) === */
|
|
|
|
createOauthClient(request: CreateOauthClientRequest, metadata?: Metadata): Observable<CreateOauthClientResponse>;
|
|
|
|
getOauthClients(request: GetOauthClientsRequest, metadata?: Metadata): Observable<GetOauthClientsResponse>;
|
|
|
|
updateOauthClient(request: UpdateOauthClientRequest, metadata?: Metadata): Observable<UpdateOauthClientResponse>;
|
|
|
|
resetOauthSecret(request: ResetOauthSecretRequest, metadata?: Metadata): Observable<ResetOauthSecretResponse>;
|
|
|
|
deleteOauthClient(request: DeleteOauthClientRequest, metadata?: Metadata): Observable<DeleteOauthClientResponse>;
|
|
}
|
|
|
|
export interface OauthServiceController {
|
|
/** === Базовый SSO (вызывается из Gateway / Графаны) === */
|
|
|
|
generateOauthCode(
|
|
request: GenerateOauthCodeRequest,
|
|
metadata?: Metadata,
|
|
): Promise<GenerateOauthCodeResponse> | Observable<GenerateOauthCodeResponse> | GenerateOauthCodeResponse;
|
|
|
|
exchangeOauthCode(
|
|
request: ExchangeOauthCodeRequest,
|
|
metadata?: Metadata,
|
|
): Promise<ExchangeOauthCodeResponse> | Observable<ExchangeOauthCodeResponse> | ExchangeOauthCodeResponse;
|
|
|
|
/** === Системные методы (Консоль Разработчика / Админка) === */
|
|
|
|
createOauthClient(
|
|
request: CreateOauthClientRequest,
|
|
metadata?: Metadata,
|
|
): Promise<CreateOauthClientResponse> | Observable<CreateOauthClientResponse> | CreateOauthClientResponse;
|
|
|
|
getOauthClients(
|
|
request: GetOauthClientsRequest,
|
|
metadata?: Metadata,
|
|
): Promise<GetOauthClientsResponse> | Observable<GetOauthClientsResponse> | GetOauthClientsResponse;
|
|
|
|
updateOauthClient(
|
|
request: UpdateOauthClientRequest,
|
|
metadata?: Metadata,
|
|
): Promise<UpdateOauthClientResponse> | Observable<UpdateOauthClientResponse> | UpdateOauthClientResponse;
|
|
|
|
resetOauthSecret(
|
|
request: ResetOauthSecretRequest,
|
|
metadata?: Metadata,
|
|
): Promise<ResetOauthSecretResponse> | Observable<ResetOauthSecretResponse> | ResetOauthSecretResponse;
|
|
|
|
deleteOauthClient(
|
|
request: DeleteOauthClientRequest,
|
|
metadata?: Metadata,
|
|
): Promise<DeleteOauthClientResponse> | Observable<DeleteOauthClientResponse> | DeleteOauthClientResponse;
|
|
}
|
|
|
|
export function OauthServiceControllerMethods() {
|
|
return function (constructor: Function) {
|
|
const grpcMethods: string[] = [
|
|
"generateOauthCode",
|
|
"exchangeOauthCode",
|
|
"createOauthClient",
|
|
"getOauthClients",
|
|
"updateOauthClient",
|
|
"resetOauthSecret",
|
|
"deleteOauthClient",
|
|
];
|
|
for (const method of grpcMethods) {
|
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
GrpcMethod("OauthService", method)(constructor.prototype[method], method, descriptor);
|
|
}
|
|
const grpcStreamMethods: string[] = [];
|
|
for (const method of grpcStreamMethods) {
|
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
GrpcStreamMethod("OauthService", method)(constructor.prototype[method], method, descriptor);
|
|
}
|
|
};
|
|
}
|
|
|
|
export const OAUTH_SERVICE_NAME = "OauthService";
|