- add: roles to user

- add: register calls for auth server
- add: user lookup by email
- add: start of password reset
- add: Cache trait to allow redis cache mocking
This commit is contained in:
2024-11-26 01:58:26 -05:00
parent 3fc6c6252c
commit 113ab5a4ac
8 changed files with 303 additions and 26 deletions

View File

@@ -5,6 +5,9 @@ package auth;
service AuthService {
rpc Login(LoginRequest) returns (LoginResponse);
rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);
rpc Register (RegisterRequest) returns (RegisterResponse);
rpc RequestPasswordReset (PasswordResetRequest) returns (PasswordResetResponse);
rpc ResetPassword (ResetPasswordRequest) returns (ResetPasswordResponse);
}
message LoginRequest {
@@ -25,3 +28,30 @@ message ValidateTokenResponse {
bool valid = 1;
string user_id = 2;
}
message RegisterRequest {
string username = 1;
string email = 2;
string password = 3;
}
message RegisterResponse {
int32 user_id = 1;
}
message PasswordResetRequest {
string email = 1;
}
message PasswordResetResponse {
string message = 1;
}
message ResetPasswordRequest {
string reset_token = 1;
string new_password = 2;
}
message ResetPasswordResponse {
string message = 1;
}

View File

@@ -6,6 +6,7 @@ service DatabaseService {
rpc GetUser(GetUserRequest) returns (GetUserResponse);
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
rpc GetUserByUsername(GetUserByUsernameRequest) returns (GetUserResponse);
rpc GetUserByEmail(GetUserByEmailRequest) returns (GetUserResponse);
}
message GetUserRequest {
@@ -16,11 +17,16 @@ message GetUserByUsernameRequest {
string username = 1;
}
message GetUserByEmailRequest {
string email = 1;
}
message GetUserResponse {
int32 user_id = 1;
string username = 2;
string email = 3;
string hashed_password = 4;
repeated string roles = 5;
}
message CreateUserRequest {