Skip to content

Commit 3300d13

Browse files
author
Ganeshwara Hananda
authored
Token renewal protocol for TypeDB Cluster (#144)
## What is the goal of this PR? We have introduced a new protocol for performing authentication token renewal in TypeDB Cluster. ## What are the changes implemented in this PR? 1. Added a new service `user_token_renew` 2. Added `Renew` request and response object
1 parent a584073 commit 3300d13

File tree

7 files changed

+54
-4
lines changed

7 files changed

+54
-4
lines changed

cluster/BUILD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,18 @@ proto_library(
2323
name = "service-proto",
2424
srcs = [":cluster_service.proto"],
2525
deps = [
26+
":client-proto",
2627
":server-proto",
2728
":user-proto",
2829
":database-proto"
2930
],
3031
)
3132

33+
proto_library(
34+
name = "client-proto",
35+
srcs = [":cluster_user_token.proto"],
36+
)
37+
3238
proto_library(
3339
name = "server-proto",
3440
srcs = [":cluster_server.proto"],

cluster/cluster_service.proto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ option java_package = "com.vaticle.typedb.protocol";
2121
option java_outer_classname = "ClusterServiceProto";
2222
option java_generic_services = true;
2323

24+
2425
import "cluster/cluster_server.proto";
2526
import "cluster/cluster_user.proto";
2627
import "cluster/cluster_database.proto";
28+
import "cluster/cluster_user_token.proto";
2729

2830
package typedb.protocol;
2931

@@ -41,6 +43,9 @@ service TypeDBCluster {
4143
rpc user_password (ClusterUser.Password.Req) returns (ClusterUser.Password.Res);
4244
rpc user_delete (ClusterUser.Delete.Req) returns (ClusterUser.Delete.Res);
4345

46+
// User Token API
47+
rpc user_token_renew (ClusterUserToken.Renew.Req) returns (ClusterUserToken.Renew.Res);
48+
4449
// Database Manager API
4550
rpc databases_get (ClusterDatabaseManager.Get.Req) returns (ClusterDatabaseManager.Get.Res);
4651
rpc databases_all (ClusterDatabaseManager.All.Req) returns (ClusterDatabaseManager.All.Res);

cluster/cluster_user.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ message ClusterUserManager {
2626

2727
message Contains {
2828
message Req {
29-
string name = 1;
29+
string username = 1;
3030
}
3131
message Res {
3232
bool contains = 1;
@@ -35,7 +35,7 @@ message ClusterUserManager {
3535

3636
message Create {
3737
message Req {
38-
string name = 1;
38+
string username = 1;
3939
string password = 2;
4040
}
4141
message Res {}
@@ -53,15 +53,15 @@ message ClusterUser {
5353

5454
message Password {
5555
message Req {
56-
string name = 1;
56+
string username = 1;
5757
string password = 2;
5858
}
5959
message Res {}
6060
}
6161

6262
message Delete {
6363
message Req {
64-
string name = 1;
64+
string username = 1;
6565
}
6666
message Res {}
6767
}

cluster/cluster_user_token.proto

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// Copyright (C) 2021 Vaticle
3+
//
4+
// This program is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Affero General Public License as
6+
// published by the Free Software Foundation, either version 3 of the
7+
// License, or (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Affero General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Affero General Public License
15+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
//
17+
18+
syntax = "proto3";
19+
20+
option java_package = "com.vaticle.typedb.protocol";
21+
option java_outer_classname = "ClusterUserTokenProto";
22+
23+
package typedb.protocol;
24+
25+
message ClusterUserToken {
26+
27+
message Renew {
28+
message Req {
29+
string username = 1;
30+
}
31+
32+
message Res {
33+
string token = 1;
34+
}
35+
}
36+
}

grpc/java/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ java_grpc_compile(
2727
name = "typedb-protocol-src",
2828
deps = [
2929
"//cluster:service-proto",
30+
"//cluster:client-proto",
3031
"//cluster:server-proto",
3132
"//cluster:user-proto",
3233
"//cluster:database-proto",

grpc/nodejs/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ nodejs_binary(
4141
ts_grpc_compile(
4242
name = "typedb-protocol-src",
4343
deps = [
44+
"//cluster:client-proto",
4445
"//cluster:server-proto",
4546
"//cluster:user-proto",
4647
"//cluster:database-proto",

grpc/python/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ load("@vaticle_dependencies//tool/checkstyle:rules.bzl", "checkstyle_test")
2525
python_grpc_compile(
2626
name = "typedb-protocol-src",
2727
deps = [
28+
"//cluster:client-proto",
2829
"//cluster:server-proto",
2930
"//cluster:user-proto",
3031
"//cluster:database-proto",

0 commit comments

Comments
 (0)