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
148 lines
2.4 KiB
syntax = "proto3";
|
|
|
|
package users;
|
|
|
|
import "google/api/annotations.proto";
|
|
import "google/protobuf/empty.proto";
|
|
|
|
option go_package = "git.chrishayward.xyz/x/users/proto";
|
|
|
|
service Users {
|
|
rpc Register (RegisterRequest) returns (RegisterResponse) {
|
|
option (google.api.http) = {
|
|
post: "/register"
|
|
};
|
|
}
|
|
|
|
rpc Login (LoginRequest) returns (LoginResponse) {
|
|
option (google.api.http) = {
|
|
post: "/login"
|
|
};
|
|
}
|
|
|
|
rpc Logout (LogoutRequest) returns (LogoutResponse) {
|
|
option (google.api.http) = {
|
|
post: "/logout"
|
|
};
|
|
}
|
|
|
|
rpc Authorize (AuthorizeRequest) returns (AuthorizeResponse) {
|
|
option (google.api.http) = {
|
|
post: "/authorize"
|
|
};
|
|
}
|
|
|
|
rpc ResetPassword (ResetPasswordRequest) returns (ResetPasswordResponse) {
|
|
option (google.api.http) = {
|
|
post: "/password/forgot"
|
|
};
|
|
}
|
|
|
|
rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse) {
|
|
option (google.api.http) = {
|
|
post: "/password/reset"
|
|
};
|
|
}
|
|
|
|
rpc ListRoles (ListRolesRequest) returns (ListRolesResponse) {
|
|
option (google.api.http) = {
|
|
post: "/roles/list"
|
|
};
|
|
}
|
|
|
|
rpc SetRoles (SetRolesRequest) returns (SetRolesResponse) {
|
|
option (google.api.http) = {
|
|
post: "/roles/set"
|
|
};
|
|
}
|
|
}
|
|
|
|
message UserForm {
|
|
string email = 1;
|
|
optional string password = 2;
|
|
optional string password_again = 3;
|
|
}
|
|
|
|
message UserToken {
|
|
string token = 1;
|
|
optional int64 expires = 2;
|
|
}
|
|
|
|
message UserInfo {
|
|
int64 id = 1;
|
|
string uuid = 2;
|
|
}
|
|
|
|
message UserRole {
|
|
int64 id = 1;
|
|
string name = 2;
|
|
}
|
|
|
|
message RegisterRequest {
|
|
UserForm form = 1;
|
|
}
|
|
|
|
message RegisterResponse {
|
|
|
|
}
|
|
|
|
message LoginRequest {
|
|
UserForm form = 1;
|
|
}
|
|
|
|
message LoginResponse {
|
|
UserToken token = 1;
|
|
}
|
|
|
|
message LogoutRequest {
|
|
UserToken token = 1;
|
|
}
|
|
|
|
message LogoutResponse {
|
|
|
|
}
|
|
|
|
message AuthorizeRequest {
|
|
string secret = 1;
|
|
UserToken token = 2;
|
|
}
|
|
|
|
message AuthorizeResponse {
|
|
UserInfo user = 1;
|
|
repeated UserRole roles = 2;
|
|
}
|
|
|
|
message ResetPasswordRequest {
|
|
UserForm form = 1;
|
|
}
|
|
|
|
message ResetPasswordResponse {
|
|
UserToken token = 1;
|
|
}
|
|
|
|
message ChangePasswordRequest {
|
|
UserToken token = 1;
|
|
UserForm form = 2;
|
|
}
|
|
|
|
message ChangePasswordResponse {
|
|
|
|
}
|
|
|
|
message ListRolesRequest {
|
|
string secret = 1;
|
|
}
|
|
|
|
message ListRolesResponse {
|
|
repeated UserRole roles = 2;
|
|
}
|
|
|
|
message SetRolesRequest {
|
|
string secret = 1;
|
|
UserInfo user = 2;
|
|
repeated UserRole roles = 3;
|
|
}
|
|
|
|
message SetRolesResponse {
|
|
|
|
}
|