From 465ed4353124ed89c1cee254c8aa6fe558a4bb9f Mon Sep 17 00:00:00 2001 From: lendry Date: Tue, 21 Apr 2026 16:01:19 +0300 Subject: [PATCH] add oauth --- package.json | 2 +- proto/sso/auth.proto | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5dbc045..40b3b2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lendry-erp/contracts", - "version": "1.2.33", + "version": "1.2.34", "description": "Protobuf definitions and generated TypeScript types", "type": "commonjs", "main": "./dist/index.js", diff --git a/proto/sso/auth.proto b/proto/sso/auth.proto index 49a905f..fef47c0 100644 --- a/proto/sso/auth.proto +++ b/proto/sso/auth.proto @@ -14,6 +14,10 @@ service AuthService { rpc GetSessions(GetSessionRequest) returns (GetSessionsResponse); rpc TerminateSession(TerminateSessionRequest) returns (TerminateSessionResponse); + // === OAuth2 SSO === + rpc GenerateOauthCode (GenerateOauthCodeRequest) returns (GenerateOauthCodeResponse); + rpc ExchangeOauthCode (ExchangeOauthCodeRequest) returns (ExchangeOauthCodeResponse); + // Системные методы для админа rpc SystemCreateAccount (SystemCreateAccountRequest) returns (SystemCreateAccountResponse); rpc SystemChangeStatus (SystemChangeStatusRequest) returns (SystemChangeStatusResponse); @@ -112,6 +116,28 @@ message TerminateSessionResponse { string message = 2; } + +// === Сообщения для OAuth2 SSO === + +message GenerateOauthCodeRequest { + string user_id = 1; +} + +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 SystemCreateAccountRequest { string username = 1; string password_hash = 2; // Хеш пароля генерирует Admin Service и передает сюда