You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
2.4 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. syntax = "proto3";
  2. package users;
  3. import "google/api/annotations.proto";
  4. import "google/protobuf/empty.proto";
  5. option go_package = "git.chrishayward.xyz/x/users/proto";
  6. service Users {
  7. rpc Register (RegisterRequest) returns (RegisterResponse) {
  8. option (google.api.http) = {
  9. post: "/register"
  10. };
  11. }
  12. rpc Login (LoginRequest) returns (LoginResponse) {
  13. option (google.api.http) = {
  14. post: "/login"
  15. };
  16. }
  17. rpc Logout (LogoutRequest) returns (LogoutResponse) {
  18. option (google.api.http) = {
  19. post: "/logout"
  20. };
  21. }
  22. rpc Authorize (AuthorizeRequest) returns (AuthorizeResponse) {
  23. option (google.api.http) = {
  24. post: "/authorize"
  25. };
  26. }
  27. rpc ResetPassword (ResetPasswordRequest) returns (ResetPasswordResponse) {
  28. option (google.api.http) = {
  29. post: "/password/forgot"
  30. };
  31. }
  32. rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse) {
  33. option (google.api.http) = {
  34. post: "/password/reset"
  35. };
  36. }
  37. rpc ListRoles (ListRolesRequest) returns (ListRolesResponse) {
  38. option (google.api.http) = {
  39. post: "/roles/list"
  40. };
  41. }
  42. rpc SetRoles (SetRolesRequest) returns (SetRolesResponse) {
  43. option (google.api.http) = {
  44. post: "/roles/set"
  45. };
  46. }
  47. }
  48. message UserForm {
  49. string email = 1;
  50. optional string password = 2;
  51. optional string password_again = 3;
  52. }
  53. message UserToken {
  54. string token = 1;
  55. optional int64 expires = 2;
  56. }
  57. message UserInfo {
  58. int64 id = 1;
  59. string uuid = 2;
  60. }
  61. message UserRole {
  62. int64 id = 1;
  63. string name = 2;
  64. }
  65. message RegisterRequest {
  66. UserForm form = 1;
  67. }
  68. message RegisterResponse {
  69. }
  70. message LoginRequest {
  71. UserForm form = 1;
  72. }
  73. message LoginResponse {
  74. UserToken token = 1;
  75. }
  76. message LogoutRequest {
  77. UserToken token = 1;
  78. }
  79. message LogoutResponse {
  80. }
  81. message AuthorizeRequest {
  82. string secret = 1;
  83. UserToken token = 2;
  84. }
  85. message AuthorizeResponse {
  86. UserInfo user = 1;
  87. repeated UserRole roles = 2;
  88. }
  89. message ResetPasswordRequest {
  90. UserForm form = 1;
  91. }
  92. message ResetPasswordResponse {
  93. UserToken token = 1;
  94. }
  95. message ChangePasswordRequest {
  96. UserToken token = 1;
  97. UserForm form = 2;
  98. }
  99. message ChangePasswordResponse {
  100. }
  101. message ListRolesRequest {
  102. string secret = 1;
  103. }
  104. message ListRolesResponse {
  105. repeated UserRole roles = 2;
  106. }
  107. message SetRolesRequest {
  108. string secret = 1;
  109. UserInfo user = 2;
  110. repeated UserRole roles = 3;
  111. }
  112. message SetRolesResponse {
  113. }