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