add full auth

This commit is contained in:
2026-07-06 15:56:10 +07:00
parent 434627d61a
commit 6be4142487
14 changed files with 1512 additions and 50 deletions
+84 -4
View File
@@ -3,19 +3,57 @@ syntax = "proto3";
package crabs.evening_detective_server;
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "pkg/proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title : "Документация сервиса \"Вечерний детектив\"";
version: "v0.1.0";
};
security_definitions: {
security: {
key : "BearerAuth";
value: {
type : TYPE_API_KEY;
in : IN_HEADER;
name : "Authorization";
description: "Authentication token, prefixed by Bearer: Bearer <token>";
}
}
}
security: {
security_requirement: {
key : "BearerAuth";
value: {};
}
}
};
service EveningDetectiveServer {
rpc Ping(PingReq) returns (PingRsp) {
option (google.api.http) = {
get: "/api/ping"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc Echo(EchoReq) returns (EchoRsp) {
option (google.api.http) = {
post: "/api/echo"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc Signup(SignupReq) returns (SignupRsp) {
@@ -23,6 +61,11 @@ service EveningDetectiveServer {
post: "/api/signup"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc RefreshPassword(RefreshPasswordReq) returns (RefreshPasswordRsp) {
@@ -30,6 +73,11 @@ service EveningDetectiveServer {
post: "/api/refresh-password"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc Login(LoginReq) returns (LoginRsp) {
@@ -37,6 +85,11 @@ service EveningDetectiveServer {
post: "/api/login"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc Refresh(RefreshReq) returns (RefreshRsp) {
@@ -44,6 +97,17 @@ service EveningDetectiveServer {
post: "/api/refresh"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
security: {
security_requirement: {}
}
};
}
rpc GetUsers(GetUsersReq) returns (GetUsersRsp) {
option (google.api.http) = {
get: "/api/users"
};
}
}
@@ -61,7 +125,7 @@ message EchoRsp {
message SignupReq {
string username = 1;
string email = 2;
string email = 2;
}
message SignupRsp {
@@ -77,12 +141,12 @@ message RefreshPasswordRsp {
}
message LoginReq {
string email = 1;
string email = 1;
string password = 2;
}
message LoginRsp {
string error = 1;
string error = 1;
string accessToken = 2;
string refreshToken = 3;
}
@@ -92,7 +156,23 @@ message RefreshReq {
}
message RefreshRsp {
string error = 1;
string error = 1;
string accessToken = 2;
string refreshToken = 3;
}
message GetUsersReq {}
message GetUsersRsp {
string error = 1;
repeated User users = 2;
}
message User {
int32 id = 1;
string username = 2;
string email = 3;
repeated string roles = 4;
bool is_active = 5;
google.protobuf.Timestamp created_at = 6;
}