auth_service.proto 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. syntax = "proto3";
  2. package memos.api.v1;
  3. import "api/v1/user_service.proto";
  4. import "google/api/annotations.proto";
  5. import "google/protobuf/empty.proto";
  6. option go_package = "gen/api/v1";
  7. service AuthService {
  8. // GetAuthStatus returns the current auth status of the user.
  9. rpc GetAuthStatus(GetAuthStatusRequest) returns (User) {
  10. option (google.api.http) = {post: "/api/v1/auth/status"};
  11. }
  12. // SignIn signs in the user with the given username and password.
  13. rpc SignIn(SignInRequest) returns (User) {
  14. option (google.api.http) = {post: "/api/v1/auth/signin"};
  15. }
  16. // SignInWithSSO signs in the user with the given SSO code.
  17. rpc SignInWithSSO(SignInWithSSORequest) returns (User) {
  18. option (google.api.http) = {post: "/api/v1/auth/signin/sso"};
  19. }
  20. // SignUp signs up the user with the given username and password.
  21. rpc SignUp(SignUpRequest) returns (User) {
  22. option (google.api.http) = {post: "/api/v1/auth/signup"};
  23. }
  24. // SignOut signs out the user.
  25. rpc SignOut(SignOutRequest) returns (google.protobuf.Empty) {
  26. option (google.api.http) = {post: "/api/v1/auth/signout"};
  27. }
  28. }
  29. message GetAuthStatusRequest {}
  30. message GetAuthStatusResponse {
  31. User user = 1;
  32. }
  33. message SignInRequest {
  34. // The username to sign in with.
  35. string username = 1;
  36. // The password to sign in with.
  37. string password = 2;
  38. // Whether the session should never expire.
  39. bool never_expire = 3;
  40. }
  41. message SignInWithSSORequest {
  42. // The ID of the SSO provider.
  43. int32 idp_id = 1;
  44. // The code to sign in with.
  45. string code = 2;
  46. // The redirect URI.
  47. string redirect_uri = 3;
  48. }
  49. message SignUpRequest {
  50. // The username to sign up with.
  51. string username = 1;
  52. // The password to sign up with.
  53. string password = 2;
  54. }
  55. message SignOutRequest {}