From e5d52ab0ba0669f63763c25ac821f7baf1529e03 Mon Sep 17 00:00:00 2001 From: lendry Date: Tue, 21 Apr 2026 16:09: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 43d5ea0..73bfbd9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lendry-erp/contracts", - "version": "1.2.35", + "version": "1.2.36", "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 b3c11c3..5beefdc 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); @@ -113,6 +117,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 и передает сюда