2023-11-30 20:58:36 +08:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package memos.api.v2;
|
|
|
|
|
2023-11-30 21:52:02 +08:00
|
|
|
import "api/v2/user_service.proto";
|
2023-11-30 20:58:36 +08:00
|
|
|
import "google/api/annotations.proto";
|
|
|
|
|
|
|
|
option go_package = "gen/api/v2";
|
|
|
|
|
|
|
|
service AuthService {
|
2024-01-29 22:43:40 +08:00
|
|
|
// GetAuthStatus returns the current auth status of the user.
|
2023-11-30 20:58:36 +08:00
|
|
|
rpc GetAuthStatus(GetAuthStatusRequest) returns (GetAuthStatusResponse) {
|
|
|
|
option (google.api.http) = {post: "/api/v2/auth/status"};
|
|
|
|
}
|
2024-01-29 22:43:40 +08:00
|
|
|
// SignIn signs in the user with the given username and password.
|
|
|
|
rpc SignIn(SignInRequest) returns (SignInResponse) {
|
|
|
|
option (google.api.http) = {post: "/api/v2/auth/signin"};
|
|
|
|
}
|
|
|
|
// SignInWithSSO signs in the user with the given SSO code.
|
|
|
|
rpc SignInWithSSO(SignInWithSSORequest) returns (SignInWithSSOResponse) {
|
|
|
|
option (google.api.http) = {post: "/api/v2/auth/signin/sso"};
|
|
|
|
}
|
|
|
|
// SignUp signs up the user with the given username and password.
|
|
|
|
rpc SignUp(SignUpRequest) returns (SignUpResponse) {
|
|
|
|
option (google.api.http) = {post: "/api/v2/auth/signup"};
|
|
|
|
}
|
|
|
|
// SignOut signs out the user.
|
|
|
|
rpc SignOut(SignOutRequest) returns (SignOutResponse) {
|
|
|
|
option (google.api.http) = {post: "/api/v2/auth/signout"};
|
|
|
|
}
|
2023-11-30 20:58:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
message GetAuthStatusRequest {}
|
|
|
|
|
|
|
|
message GetAuthStatusResponse {
|
2023-11-30 21:52:02 +08:00
|
|
|
User user = 1;
|
2023-11-30 20:58:36 +08:00
|
|
|
}
|
2024-01-29 22:43:40 +08:00
|
|
|
|
|
|
|
message SignInRequest {
|
|
|
|
string username = 1;
|
|
|
|
string password = 2;
|
2024-01-29 23:12:02 +08:00
|
|
|
bool never_expire = 3;
|
2024-01-29 22:43:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
message SignInResponse {
|
|
|
|
User user = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SignInWithSSORequest {
|
|
|
|
int32 idp_id = 1;
|
|
|
|
string code = 2;
|
|
|
|
string redirect_uri = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SignInWithSSOResponse {
|
|
|
|
User user = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SignUpRequest {
|
|
|
|
string username = 1;
|
|
|
|
string password = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SignUpResponse {
|
|
|
|
User user = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SignOutRequest {}
|
|
|
|
|
|
|
|
message SignOutResponse {}
|