Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add sign-in request for authentication token retrieval #216

Draft
wants to merge 6 commits into
base: 3.0
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions grpc/java/BUILD
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ java_grpc_library(
"//proto:answer-proto",
"//proto:concept-proto",
"//proto:connection-proto",
"//proto:authentication-proto",
"//proto:logic-proto",
"//proto:options-proto",
"//proto:query-proto",
1 change: 1 addition & 0 deletions grpc/nodejs/BUILD
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@ ts_grpc_compile(
"//proto:answer-proto",
"//proto:concept-proto",
"//proto:connection-proto",
"//proto:authentication-proto",
"//proto:logic-proto",
"//proto:options-proto",
"//proto:query-proto",
1 change: 1 addition & 0 deletions grpc/rust/BUILD
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ rust_tonic_compile(
"//proto:answer-proto",
"//proto:concept-proto",
"//proto:connection-proto",
"//proto:authentication-proto",
"//proto:logic-proto",
"//proto:options-proto",
"//proto:query-proto",
11 changes: 9 additions & 2 deletions proto/BUILD
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ proto_library(
srcs = [":typedb-service.proto"],
deps = [
":connection-proto",
":authentication-proto",
":server-proto",
":user-proto",
":database-proto",
@@ -39,6 +40,11 @@ proto_library(
deps = [":concept-proto"],
)

proto_library(
name = "authentication-proto",
srcs = ["authentication.proto"],
)

proto_library(
name = "concept-proto",
srcs = ["concept.proto"],
@@ -48,8 +54,9 @@ proto_library(
name = "connection-proto",
srcs = ["connection.proto"],
deps = [
":version-proto",
":database-proto"
":authentication-proto",
":database-proto",
":version-proto"
],
)

29 changes: 29 additions & 0 deletions proto/authentication.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

syntax = "proto3";

package typedb.protocol;

message Authentication {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't feel like a part of the User API, so I declared a new package. In the future, there can be RefreshToken or whatever, so it won't be totally empty, and the scope is clearer.

message Token {
message Create {
message Req {
message Password {
string username = 1;
string password = 2;
}

oneof credentials {
Password password = 1;
// extend by other credential kinds
}
}

message Res {
string token = 1;
}
}
}
}
9 changes: 6 additions & 3 deletions proto/connection.proto
Original file line number Diff line number Diff line change
@@ -4,8 +4,9 @@

syntax = "proto3";

import "proto/version.proto";
import "proto/authentication.proto";
import "proto/database.proto";
import "proto/version.proto";

package typedb.protocol;

@@ -16,16 +17,18 @@ message Connection {
Version version = 1;
string driver_lang = 2;
string driver_version = 3;

Authentication.Token.Create.Req authentication = 4;
}

message Res {
uint64 server_duration_millis = 1;
ConnectionID connection_id = 2;

// TODO: initial Token

// pre-send all databases and replica info
DatabaseManager.All.Res databases_all = 3;

Authentication.Token.Create.Res authentication = 4;
}
}
}
1 change: 0 additions & 1 deletion proto/query.proto
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ syntax = "proto3";

import "proto/answer.proto";
import "proto/options.proto";
import "proto/concept.proto";

package typedb.protocol;

4 changes: 4 additions & 0 deletions proto/typedb-service.proto
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

syntax = "proto3";

import "proto/authentication.proto";
import "proto/connection.proto";
import "proto/database.proto";
import "proto/server.proto";
@@ -17,6 +18,9 @@ service TypeDB {
// Connection API
rpc connection_open (Connection.Open.Req) returns (Connection.Open.Res);

// Authentication API
rpc authentication_token_create (Authentication.Token.Create.Req) returns (Authentication.Token.Create.Res);

// Server Manager API
rpc servers_all (ServerManager.All.Req) returns (ServerManager.All.Res);