add oauth methods for developers
All checks were successful
Publish / Publish Job (push) Successful in 2m30s
All checks were successful
Publish / Publish Job (push) Successful in 2m30s
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lendry-erp/contracts",
|
"name": "@lendry-erp/contracts",
|
||||||
"version": "1.2.38",
|
"version": "1.2.39",
|
||||||
"description": "Protobuf definitions and generated TypeScript types",
|
"description": "Protobuf definitions and generated TypeScript types",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
|||||||
@@ -9,16 +9,15 @@ service OauthService {
|
|||||||
rpc GenerateOauthCode (GenerateOauthCodeRequest) returns (GenerateOauthCodeResponse);
|
rpc GenerateOauthCode (GenerateOauthCodeRequest) returns (GenerateOauthCodeResponse);
|
||||||
rpc ExchangeOauthCode (ExchangeOauthCodeRequest) returns (ExchangeOauthCodeResponse);
|
rpc ExchangeOauthCode (ExchangeOauthCodeRequest) returns (ExchangeOauthCodeResponse);
|
||||||
|
|
||||||
// === Системные методы для Админки (Управление клиентами) ===
|
// === Системные методы (Консоль Разработчика / Админка) ===
|
||||||
rpc SystemCreateOauthClient (SystemCreateOauthClientRequest) returns (SystemCreateOauthClientResponse);
|
rpc CreateOauthClient (CreateOauthClientRequest) returns (CreateOauthClientResponse);
|
||||||
rpc SystemGetOauthClients (SystemGetOauthClientsRequest) returns (SystemGetOauthClientsResponse);
|
rpc GetOauthClients (GetOauthClientsRequest) returns (GetOauthClientsResponse);
|
||||||
rpc SystemUpdateOauthClient (SystemUpdateOauthClientRequest) returns (SystemUpdateOauthClientResponse);
|
rpc UpdateOauthClient (UpdateOauthClientRequest) returns (UpdateOauthClientResponse);
|
||||||
rpc SystemResetOauthSecret (SystemResetOauthSecretRequest) returns (SystemResetOauthSecretResponse);
|
rpc ResetOauthSecret (ResetOauthSecretRequest) returns (ResetOauthSecretResponse);
|
||||||
rpc SystemDeleteOauthClient (SystemDeleteOauthClientRequest) returns (SystemDeleteOauthClientResponse);
|
rpc DeleteOauthClient (DeleteOauthClientRequest) returns (DeleteOauthClientResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Сообщения для базового SSO ---
|
// --- Сообщения для базового SSO ---
|
||||||
|
|
||||||
message GenerateOauthCodeRequest {
|
message GenerateOauthCodeRequest {
|
||||||
string user_id = 1;
|
string user_id = 1;
|
||||||
string client_id = 2;
|
string client_id = 2;
|
||||||
@@ -40,20 +39,28 @@ message ExchangeOauthCodeResponse {
|
|||||||
int32 expires_in = 2;
|
int32 expires_in = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Сообщения для управления клиентами (Yandex/Google style) ---
|
// --- Сообщения для управления клиентами ---
|
||||||
|
message CreateOauthClientRequest {
|
||||||
message SystemCreateOauthClientRequest {
|
string owner_id = 1;
|
||||||
string name = 1; // Название приложения (например, "Grafana Analytics")
|
string name = 2;
|
||||||
repeated string redirect_uris = 2; // Список разрешенных коллбеков
|
repeated string redirect_uris = 3;
|
||||||
optional string description = 3; // Описание (для админки)
|
optional string description = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SystemCreateOauthClientResponse {
|
message CreateOauthClientResponse {
|
||||||
string id = 1; // Внутренний ID в базе
|
string id = 1;
|
||||||
string name = 2;
|
string name = 2;
|
||||||
string client_id = 3; // Публичный ID клиента (app_...)
|
string client_id = 3;
|
||||||
string plain_secret = 4; // ВАЖНО: Чистый секрет. Отдается ТОЛЬКО здесь один раз!
|
string plain_secret = 4; // Отдается ТОЛЬКО здесь один раз
|
||||||
repeated string redirect_uris = 5;
|
repeated string redirect_uris = 5;
|
||||||
|
string owner_id = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetOauthClientsRequest {
|
||||||
|
string owner_id = 1;
|
||||||
|
bool is_admin = 2; // Если true, owner_id игнорируется, выдаются все клиенты
|
||||||
|
int32 limit = 3;
|
||||||
|
int32 offset = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message OauthClientItem {
|
message OauthClientItem {
|
||||||
@@ -62,43 +69,44 @@ message OauthClientItem {
|
|||||||
string client_id = 3;
|
string client_id = 3;
|
||||||
repeated string redirect_uris = 4;
|
repeated string redirect_uris = 4;
|
||||||
optional string description = 5;
|
optional string description = 5;
|
||||||
int64 created_at = 6;
|
string owner_id = 6;
|
||||||
// Обратите внимание: поля secret здесь нет! Секрет нельзя получить списком.
|
int64 created_at = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SystemGetOauthClientsRequest {
|
message GetOauthClientsResponse {
|
||||||
int32 limit = 1;
|
|
||||||
int32 offset = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SystemGetOauthClientsResponse {
|
|
||||||
repeated OauthClientItem clients = 1;
|
repeated OauthClientItem clients = 1;
|
||||||
int32 total = 2;
|
int32 total = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SystemUpdateOauthClientRequest {
|
message UpdateOauthClientRequest {
|
||||||
string client_id = 1;
|
string client_id = 1;
|
||||||
optional string name = 2;
|
string owner_id = 2; // ID того, кто делает запрос
|
||||||
repeated string redirect_uris = 3; // Если передано, полностью перезаписывает старые
|
bool is_admin = 3;
|
||||||
optional string description = 4;
|
optional string name = 4;
|
||||||
|
repeated string redirect_uris = 5;
|
||||||
|
optional string description = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SystemUpdateOauthClientResponse {
|
message UpdateOauthClientResponse {
|
||||||
bool success = 1;
|
bool success = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SystemResetOauthSecretRequest {
|
message ResetOauthSecretRequest {
|
||||||
string client_id = 1;
|
string client_id = 1;
|
||||||
|
string owner_id = 2;
|
||||||
|
bool is_admin = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SystemResetOauthSecretResponse {
|
message ResetOauthSecretResponse {
|
||||||
string new_plain_secret = 1; // Возвращаем новый сгенерированный секрет
|
string new_plain_secret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SystemDeleteOauthClientRequest {
|
message DeleteOauthClientRequest {
|
||||||
string client_id = 1;
|
string client_id = 1;
|
||||||
|
string owner_id = 2;
|
||||||
|
bool is_admin = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SystemDeleteOauthClientResponse {
|
message DeleteOauthClientResponse {
|
||||||
bool success = 1;
|
bool success = 1;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user