112 lines
3.0 KiB
Protocol Buffer
112 lines
3.0 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package oauth.v1;
|
|
|
|
option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
|
|
|
|
service OauthService {
|
|
// === Базовый SSO (вызывается из Gateway / Графаны) ===
|
|
rpc GenerateOauthCode (GenerateOauthCodeRequest) returns (GenerateOauthCodeResponse);
|
|
rpc ExchangeOauthCode (ExchangeOauthCodeRequest) returns (ExchangeOauthCodeResponse);
|
|
|
|
// === Системные методы (Консоль Разработчика / Админка) ===
|
|
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;
|
|
string redirect_uri = 3;
|
|
}
|
|
|
|
message GenerateOauthCodeResponse {
|
|
string code = 1;
|
|
}
|
|
|
|
message ExchangeOauthCodeRequest {
|
|
string code = 1;
|
|
string client_id = 2;
|
|
string client_secret = 3;
|
|
}
|
|
|
|
message ExchangeOauthCodeResponse {
|
|
string access_token = 1;
|
|
int32 expires_in = 2;
|
|
}
|
|
|
|
// --- Сообщения для управления клиентами ---
|
|
message CreateOauthClientRequest {
|
|
string owner_id = 1;
|
|
string name = 2;
|
|
repeated string redirect_uris = 3;
|
|
optional string description = 4;
|
|
}
|
|
|
|
message CreateOauthClientResponse {
|
|
string id = 1;
|
|
string name = 2;
|
|
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 {
|
|
string id = 1;
|
|
string name = 2;
|
|
string client_id = 3;
|
|
repeated string redirect_uris = 4;
|
|
optional string description = 5;
|
|
string owner_id = 6;
|
|
int64 created_at = 7;
|
|
}
|
|
|
|
message GetOauthClientsResponse {
|
|
repeated OauthClientItem clients = 1;
|
|
int32 total = 2;
|
|
}
|
|
|
|
message UpdateOauthClientRequest {
|
|
string client_id = 1;
|
|
string owner_id = 2; // ID того, кто делает запрос
|
|
bool is_admin = 3;
|
|
optional string name = 4;
|
|
repeated string redirect_uris = 5;
|
|
optional string description = 6;
|
|
}
|
|
|
|
message UpdateOauthClientResponse {
|
|
bool success = 1;
|
|
}
|
|
|
|
message ResetOauthSecretRequest {
|
|
string client_id = 1;
|
|
string owner_id = 2;
|
|
bool is_admin = 3;
|
|
}
|
|
|
|
message ResetOauthSecretResponse {
|
|
string new_plain_secret = 1;
|
|
}
|
|
|
|
message DeleteOauthClientRequest {
|
|
string client_id = 1;
|
|
string owner_id = 2;
|
|
bool is_admin = 3;
|
|
}
|
|
|
|
message DeleteOauthClientResponse {
|
|
bool success = 1;
|
|
} |