2023-11-30 15:58:36 +03:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2024-04-27 19:44:29 +03:00
|
|
|
package memos.api.v1;
|
2023-11-30 15:58:36 +03:00
|
|
|
|
2024-04-27 19:44:29 +03:00
|
|
|
import "api/v1/user_service.proto";
|
2023-11-30 15:58:36 +03:00
|
|
|
import "google/api/annotations.proto";
|
2024-04-27 17:02:15 +03:00
|
|
|
import "google/protobuf/empty.proto";
|
2023-11-30 15:58:36 +03:00
|
|
|
|
2024-04-27 19:44:29 +03:00
|
|
|
option go_package = "gen/api/v1";
|
2023-11-30 15:58:36 +03:00
|
|
|
|
|
|
|
service AuthService {
|
2024-01-29 17:43:40 +03:00
|
|
|
// GetAuthStatus returns the current auth status of the user.
|
2024-04-27 17:02:15 +03:00
|
|
|
rpc GetAuthStatus(GetAuthStatusRequest) returns (User) {
|
2024-04-27 19:44:29 +03:00
|
|
|
option (google.api.http) = {post: "/api/v1/auth/status"};
|
2023-11-30 15:58:36 +03:00
|
|
|
}
|
2024-01-29 17:43:40 +03:00
|
|
|
// SignIn signs in the user with the given username and password.
|
2024-04-27 17:02:15 +03:00
|
|
|
rpc SignIn(SignInRequest) returns (User) {
|
2024-04-27 19:44:29 +03:00
|
|
|
option (google.api.http) = {post: "/api/v1/auth/signin"};
|
2024-01-29 17:43:40 +03:00
|
|
|
}
|
|
|
|
// SignInWithSSO signs in the user with the given SSO code.
|
2024-04-27 17:02:15 +03:00
|
|
|
rpc SignInWithSSO(SignInWithSSORequest) returns (User) {
|
2024-04-27 19:44:29 +03:00
|
|
|
option (google.api.http) = {post: "/api/v1/auth/signin/sso"};
|
2024-01-29 17:43:40 +03:00
|
|
|
}
|
|
|
|
// SignUp signs up the user with the given username and password.
|
2024-04-27 17:02:15 +03:00
|
|
|
rpc SignUp(SignUpRequest) returns (User) {
|
2024-04-27 19:44:29 +03:00
|
|
|
option (google.api.http) = {post: "/api/v1/auth/signup"};
|
2024-01-29 17:43:40 +03:00
|
|
|
}
|
|
|
|
// SignOut signs out the user.
|
2024-04-27 17:02:15 +03:00
|
|
|
rpc SignOut(SignOutRequest) returns (google.protobuf.Empty) {
|
2024-04-27 19:44:29 +03:00
|
|
|
option (google.api.http) = {post: "/api/v1/auth/signout"};
|
2024-01-29 17:43:40 +03:00
|
|
|
}
|
2023-11-30 15:58:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
message GetAuthStatusRequest {}
|
|
|
|
|
|
|
|
message GetAuthStatusResponse {
|
2023-11-30 16:52:02 +03:00
|
|
|
User user = 1;
|
2023-11-30 15:58:36 +03:00
|
|
|
}
|
2024-01-29 17:43:40 +03:00
|
|
|
|
|
|
|
message SignInRequest {
|
2024-04-16 17:33:25 +03:00
|
|
|
// The username to sign in with.
|
2024-01-29 17:43:40 +03:00
|
|
|
string username = 1;
|
2024-04-16 17:33:25 +03:00
|
|
|
// The password to sign in with.
|
2024-01-29 17:43:40 +03:00
|
|
|
string password = 2;
|
2024-04-16 17:33:25 +03:00
|
|
|
// Whether the session should never expire.
|
2024-01-29 18:12:02 +03:00
|
|
|
bool never_expire = 3;
|
2024-01-29 17:43:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
message SignInWithSSORequest {
|
2024-04-16 17:33:25 +03:00
|
|
|
// The ID of the SSO provider.
|
2024-01-29 17:43:40 +03:00
|
|
|
int32 idp_id = 1;
|
2024-04-16 17:33:25 +03:00
|
|
|
// The code to sign in with.
|
2024-01-29 17:43:40 +03:00
|
|
|
string code = 2;
|
2024-04-16 17:33:25 +03:00
|
|
|
// The redirect URI.
|
2024-01-29 17:43:40 +03:00
|
|
|
string redirect_uri = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SignUpRequest {
|
2024-04-16 17:33:25 +03:00
|
|
|
// The username to sign up with.
|
2024-01-29 17:43:40 +03:00
|
|
|
string username = 1;
|
2024-04-16 17:33:25 +03:00
|
|
|
// The password to sign up with.
|
2024-01-29 17:43:40 +03:00
|
|
|
string password = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SignOutRequest {}
|