mirror of
https://github.com/hexedtech/codemp.git
synced 2024-12-22 21:04:53 +01:00
feat: add auth service
sneaked in to help with server development
This commit is contained in:
parent
164e9887b8
commit
1ee185b5ec
3 changed files with 26 additions and 5 deletions
9
build.rs
9
build.rs
|
@ -1,7 +1,7 @@
|
|||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tonic_build::configure()
|
||||
// .build_client(cfg!(feature = "client"))
|
||||
//.build_server(cfg!(feature = "server")) // FIXME if false, build fails????
|
||||
// .build_server(cfg!(feature = "server")) // FIXME if false, build fails????
|
||||
// .build_transport(cfg!(feature = "transport"))
|
||||
.compile(
|
||||
&[
|
||||
|
@ -11,9 +11,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
"proto/workspace.proto",
|
||||
"proto/buffer_service.proto",
|
||||
"proto/cursor_service.proto",
|
||||
"proto/workspace_service.proto"
|
||||
"proto/workspace_service.proto",
|
||||
"proto/auth_service.proto",
|
||||
],
|
||||
&["proto"]
|
||||
&["proto"],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
19
proto/auth_service.proto
Normal file
19
proto/auth_service.proto
Normal file
|
@ -0,0 +1,19 @@
|
|||
syntax = "proto2";
|
||||
|
||||
package auth_service;
|
||||
|
||||
// authenticates users, issuing tokens
|
||||
service Auth {
|
||||
// send credentials and join a workspace
|
||||
rpc Login (WorkspaceJoinRequest) returns (Token);
|
||||
}
|
||||
|
||||
message Token {
|
||||
required string token = 1;
|
||||
}
|
||||
|
||||
message WorkspaceJoinRequest {
|
||||
required string workspace_id = 1;
|
||||
required string username = 2;
|
||||
required string password = 3;
|
||||
}
|
|
@ -173,7 +173,8 @@ pub mod proto {
|
|||
pub mod buffer_service { tonic::include_proto!("buffer_service"); }
|
||||
pub mod cursor_service { tonic::include_proto!("cursor_service"); }
|
||||
pub mod workspace_service { tonic::include_proto!("workspace_service"); }
|
||||
pub mod auth_service { tonic::include_proto!("auth_service"); }
|
||||
}
|
||||
|
||||
pub use errors::Error;
|
||||
pub use errors::Result;
|
||||
pub use errors::Result;
|
||||
|
|
Loading…
Reference in a new issue