chore: update auth service

This commit is contained in:
Steven 2024-08-06 21:56:00 +08:00
parent e12c83137d
commit 6db8611a58
11 changed files with 377 additions and 414 deletions

View File

@ -44,7 +44,7 @@ const SignIn: React.FC = () => {
try { try {
actionBtnLoadingState.setLoading(); actionBtnLoadingState.setLoading();
const { user } = await authServiceClient.signIn({ email, password }); const user = await authServiceClient.signIn({ email, password });
if (user) { if (user) {
userStore.setCurrentUserId(user.id); userStore.setCurrentUserId(user.id);
await userStore.fetchCurrentUser(); await userStore.fetchCurrentUser();

View File

@ -51,7 +51,7 @@ const SignUp: React.FC = () => {
try { try {
actionBtnLoadingState.setLoading(); actionBtnLoadingState.setLoading();
const { user } = await authServiceClient.signUp({ const user = await authServiceClient.signUp({
email, email,
nickname, nickname,
password, password,

View File

@ -38,7 +38,7 @@ const useUserStore = create<UserState>()((set, get) => ({
return users; return users;
}, },
fetchCurrentUser: async () => { fetchCurrentUser: async () => {
const { user } = await authServiceClient.getAuthStatus({}); const user = await authServiceClient.getAuthStatus({});
if (!user) { if (!user) {
throw new Error("User not found"); throw new Error("User not found");
} }

View File

@ -4,49 +4,53 @@ package slash.api.v1;
import "api/v1/user_service.proto"; import "api/v1/user_service.proto";
import "google/api/annotations.proto"; import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
option go_package = "gen/api/v1"; option go_package = "gen/api/v1";
service AuthService { service AuthService {
rpc GetAuthStatus(GetAuthStatusRequest) returns (GetAuthStatusResponse) { // GetAuthStatus returns the current auth status of the user.
rpc GetAuthStatus(GetAuthStatusRequest) returns (User) {
option (google.api.http) = {post: "/api/v1/auth/status"}; option (google.api.http) = {post: "/api/v1/auth/status"};
} }
rpc SignIn(SignInRequest) returns (SignInResponse) { // SignIn signs in the user with the given username and password.
rpc SignIn(SignInRequest) returns (User) {
option (google.api.http) = {post: "/api/v1/auth/signin"}; option (google.api.http) = {post: "/api/v1/auth/signin"};
} }
rpc SignUp(SignUpRequest) returns (SignUpResponse) { // SignInWithSSO signs in the user with the given SSO code.
rpc SignInWithSSO(SignInWithSSORequest) returns (User) {
option (google.api.http) = {post: "/api/v1/auth/signin/sso"};
}
// SignUp signs up the user with the given username and password.
rpc SignUp(SignUpRequest) returns (User) {
option (google.api.http) = {post: "/api/v1/auth/signup"}; option (google.api.http) = {post: "/api/v1/auth/signup"};
} }
rpc SignOut(SignOutRequest) returns (SignOutResponse) { // SignOut signs out the user.
rpc SignOut(SignOutRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {post: "/api/v1/auth/signout"}; option (google.api.http) = {post: "/api/v1/auth/signout"};
} }
} }
message GetAuthStatusRequest {} message GetAuthStatusRequest {}
message GetAuthStatusResponse {
User user = 1;
}
message SignInRequest { message SignInRequest {
string email = 1; string email = 1;
string password = 2; string password = 2;
} }
message SignInResponse {
User user = 1;
}
message SignUpRequest { message SignUpRequest {
string email = 1; string email = 1;
string nickname = 2; string nickname = 2;
string password = 3; string password = 3;
} }
message SignUpResponse { message SignInWithSSORequest {
User user = 1; // The name of the SSO provider.
int32 idp_name = 1;
// The code to sign in with.
string code = 2;
// The redirect URI.
string redirect_uri = 3;
} }
message SignOutRequest {} message SignOutRequest {}
message SignOutResponse {}

View File

@ -5,7 +5,7 @@ breaking:
- FILE - FILE
lint: lint:
use: use:
- DEFAULT - BASIC
except: except:
- ENUM_VALUE_PREFIX - ENUM_VALUE_PREFIX
- PACKAGE_DIRECTORY_MATCH - PACKAGE_DIRECTORY_MATCH

View File

@ -33,13 +33,10 @@
- [api/v1/auth_service.proto](#api_v1_auth_service-proto) - [api/v1/auth_service.proto](#api_v1_auth_service-proto)
- [GetAuthStatusRequest](#slash-api-v1-GetAuthStatusRequest) - [GetAuthStatusRequest](#slash-api-v1-GetAuthStatusRequest)
- [GetAuthStatusResponse](#slash-api-v1-GetAuthStatusResponse)
- [SignInRequest](#slash-api-v1-SignInRequest) - [SignInRequest](#slash-api-v1-SignInRequest)
- [SignInResponse](#slash-api-v1-SignInResponse) - [SignInWithSSORequest](#slash-api-v1-SignInWithSSORequest)
- [SignOutRequest](#slash-api-v1-SignOutRequest) - [SignOutRequest](#slash-api-v1-SignOutRequest)
- [SignOutResponse](#slash-api-v1-SignOutResponse)
- [SignUpRequest](#slash-api-v1-SignUpRequest) - [SignUpRequest](#slash-api-v1-SignUpRequest)
- [SignUpResponse](#slash-api-v1-SignUpResponse)
- [AuthService](#slash-api-v1-AuthService) - [AuthService](#slash-api-v1-AuthService)
@ -501,21 +498,6 @@
<a name="slash-api-v1-GetAuthStatusResponse"></a>
### GetAuthStatusResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| user | [User](#slash-api-v1-User) | | |
<a name="slash-api-v1-SignInRequest"></a> <a name="slash-api-v1-SignInRequest"></a>
### SignInRequest ### SignInRequest
@ -532,15 +514,17 @@
<a name="slash-api-v1-SignInResponse"></a> <a name="slash-api-v1-SignInWithSSORequest"></a>
### SignInResponse ### SignInWithSSORequest
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| user | [User](#slash-api-v1-User) | | | | idp_name | [int32](#int32) | | The name of the SSO provider. |
| code | [string](#string) | | The code to sign in with. |
| redirect_uri | [string](#string) | | The redirect URI. |
@ -557,16 +541,6 @@
<a name="slash-api-v1-SignOutResponse"></a>
### SignOutResponse
<a name="slash-api-v1-SignUpRequest"></a> <a name="slash-api-v1-SignUpRequest"></a>
### SignUpRequest ### SignUpRequest
@ -583,21 +557,6 @@
<a name="slash-api-v1-SignUpResponse"></a>
### SignUpResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| user | [User](#slash-api-v1-User) | | |
@ -612,10 +571,11 @@
| Method Name | Request Type | Response Type | Description | | Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------| | ----------- | ------------ | ------------- | ------------|
| GetAuthStatus | [GetAuthStatusRequest](#slash-api-v1-GetAuthStatusRequest) | [GetAuthStatusResponse](#slash-api-v1-GetAuthStatusResponse) | | | GetAuthStatus | [GetAuthStatusRequest](#slash-api-v1-GetAuthStatusRequest) | [User](#slash-api-v1-User) | GetAuthStatus returns the current auth status of the user. |
| SignIn | [SignInRequest](#slash-api-v1-SignInRequest) | [SignInResponse](#slash-api-v1-SignInResponse) | | | SignIn | [SignInRequest](#slash-api-v1-SignInRequest) | [User](#slash-api-v1-User) | SignIn signs in the user with the given username and password. |
| SignUp | [SignUpRequest](#slash-api-v1-SignUpRequest) | [SignUpResponse](#slash-api-v1-SignUpResponse) | | | SignInWithSSO | [SignInWithSSORequest](#slash-api-v1-SignInWithSSORequest) | [User](#slash-api-v1-User) | SignInWithSSO signs in the user with the given SSO code. |
| SignOut | [SignOutRequest](#slash-api-v1-SignOutRequest) | [SignOutResponse](#slash-api-v1-SignOutResponse) | | | SignUp | [SignUpRequest](#slash-api-v1-SignUpRequest) | [User](#slash-api-v1-User) | SignUp signs up the user with the given username and password. |
| SignOut | [SignOutRequest](#slash-api-v1-SignOutRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | SignOut signs out the user. |

View File

@ -10,6 +10,7 @@ import (
_ "google.golang.org/genproto/googleapis/api/annotations" _ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
) )
@ -59,53 +60,6 @@ func (*GetAuthStatusRequest) Descriptor() ([]byte, []int) {
return file_api_v1_auth_service_proto_rawDescGZIP(), []int{0} return file_api_v1_auth_service_proto_rawDescGZIP(), []int{0}
} }
type GetAuthStatusResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
}
func (x *GetAuthStatusResponse) Reset() {
*x = GetAuthStatusResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v1_auth_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetAuthStatusResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetAuthStatusResponse) ProtoMessage() {}
func (x *GetAuthStatusResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_auth_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetAuthStatusResponse.ProtoReflect.Descriptor instead.
func (*GetAuthStatusResponse) Descriptor() ([]byte, []int) {
return file_api_v1_auth_service_proto_rawDescGZIP(), []int{1}
}
func (x *GetAuthStatusResponse) GetUser() *User {
if x != nil {
return x.User
}
return nil
}
type SignInRequest struct { type SignInRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -118,7 +72,7 @@ type SignInRequest struct {
func (x *SignInRequest) Reset() { func (x *SignInRequest) Reset() {
*x = SignInRequest{} *x = SignInRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_api_v1_auth_service_proto_msgTypes[2] mi := &file_api_v1_auth_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -131,7 +85,7 @@ func (x *SignInRequest) String() string {
func (*SignInRequest) ProtoMessage() {} func (*SignInRequest) ProtoMessage() {}
func (x *SignInRequest) ProtoReflect() protoreflect.Message { func (x *SignInRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_auth_service_proto_msgTypes[2] mi := &file_api_v1_auth_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -144,7 +98,7 @@ func (x *SignInRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SignInRequest.ProtoReflect.Descriptor instead. // Deprecated: Use SignInRequest.ProtoReflect.Descriptor instead.
func (*SignInRequest) Descriptor() ([]byte, []int) { func (*SignInRequest) Descriptor() ([]byte, []int) {
return file_api_v1_auth_service_proto_rawDescGZIP(), []int{2} return file_api_v1_auth_service_proto_rawDescGZIP(), []int{1}
} }
func (x *SignInRequest) GetEmail() string { func (x *SignInRequest) GetEmail() string {
@ -161,53 +115,6 @@ func (x *SignInRequest) GetPassword() string {
return "" return ""
} }
type SignInResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
}
func (x *SignInResponse) Reset() {
*x = SignInResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v1_auth_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SignInResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SignInResponse) ProtoMessage() {}
func (x *SignInResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_auth_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SignInResponse.ProtoReflect.Descriptor instead.
func (*SignInResponse) Descriptor() ([]byte, []int) {
return file_api_v1_auth_service_proto_rawDescGZIP(), []int{3}
}
func (x *SignInResponse) GetUser() *User {
if x != nil {
return x.User
}
return nil
}
type SignUpRequest struct { type SignUpRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -221,7 +128,7 @@ type SignUpRequest struct {
func (x *SignUpRequest) Reset() { func (x *SignUpRequest) Reset() {
*x = SignUpRequest{} *x = SignUpRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_api_v1_auth_service_proto_msgTypes[4] mi := &file_api_v1_auth_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -234,7 +141,7 @@ func (x *SignUpRequest) String() string {
func (*SignUpRequest) ProtoMessage() {} func (*SignUpRequest) ProtoMessage() {}
func (x *SignUpRequest) ProtoReflect() protoreflect.Message { func (x *SignUpRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_auth_service_proto_msgTypes[4] mi := &file_api_v1_auth_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -247,7 +154,7 @@ func (x *SignUpRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SignUpRequest.ProtoReflect.Descriptor instead. // Deprecated: Use SignUpRequest.ProtoReflect.Descriptor instead.
func (*SignUpRequest) Descriptor() ([]byte, []int) { func (*SignUpRequest) Descriptor() ([]byte, []int) {
return file_api_v1_auth_service_proto_rawDescGZIP(), []int{4} return file_api_v1_auth_service_proto_rawDescGZIP(), []int{2}
} }
func (x *SignUpRequest) GetEmail() string { func (x *SignUpRequest) GetEmail() string {
@ -271,31 +178,36 @@ func (x *SignUpRequest) GetPassword() string {
return "" return ""
} }
type SignUpResponse struct { type SignInWithSSORequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` // The name of the SSO provider.
IdpName int32 `protobuf:"varint,1,opt,name=idp_name,json=idpName,proto3" json:"idp_name,omitempty"`
// The code to sign in with.
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
// The redirect URI.
RedirectUri string `protobuf:"bytes,3,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"`
} }
func (x *SignUpResponse) Reset() { func (x *SignInWithSSORequest) Reset() {
*x = SignUpResponse{} *x = SignInWithSSORequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_api_v1_auth_service_proto_msgTypes[5] mi := &file_api_v1_auth_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
} }
func (x *SignUpResponse) String() string { func (x *SignInWithSSORequest) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*SignUpResponse) ProtoMessage() {} func (*SignInWithSSORequest) ProtoMessage() {}
func (x *SignUpResponse) ProtoReflect() protoreflect.Message { func (x *SignInWithSSORequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_auth_service_proto_msgTypes[5] mi := &file_api_v1_auth_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -306,16 +218,30 @@ func (x *SignUpResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use SignUpResponse.ProtoReflect.Descriptor instead. // Deprecated: Use SignInWithSSORequest.ProtoReflect.Descriptor instead.
func (*SignUpResponse) Descriptor() ([]byte, []int) { func (*SignInWithSSORequest) Descriptor() ([]byte, []int) {
return file_api_v1_auth_service_proto_rawDescGZIP(), []int{5} return file_api_v1_auth_service_proto_rawDescGZIP(), []int{3}
} }
func (x *SignUpResponse) GetUser() *User { func (x *SignInWithSSORequest) GetIdpName() int32 {
if x != nil { if x != nil {
return x.User return x.IdpName
} }
return nil return 0
}
func (x *SignInWithSSORequest) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *SignInWithSSORequest) GetRedirectUri() string {
if x != nil {
return x.RedirectUri
}
return ""
} }
type SignOutRequest struct { type SignOutRequest struct {
@ -327,7 +253,7 @@ type SignOutRequest struct {
func (x *SignOutRequest) Reset() { func (x *SignOutRequest) Reset() {
*x = SignOutRequest{} *x = SignOutRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_api_v1_auth_service_proto_msgTypes[6] mi := &file_api_v1_auth_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -340,7 +266,7 @@ func (x *SignOutRequest) String() string {
func (*SignOutRequest) ProtoMessage() {} func (*SignOutRequest) ProtoMessage() {}
func (x *SignOutRequest) ProtoReflect() protoreflect.Message { func (x *SignOutRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_auth_service_proto_msgTypes[6] mi := &file_api_v1_auth_service_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -353,45 +279,7 @@ func (x *SignOutRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SignOutRequest.ProtoReflect.Descriptor instead. // Deprecated: Use SignOutRequest.ProtoReflect.Descriptor instead.
func (*SignOutRequest) Descriptor() ([]byte, []int) { func (*SignOutRequest) Descriptor() ([]byte, []int) {
return file_api_v1_auth_service_proto_rawDescGZIP(), []int{6} return file_api_v1_auth_service_proto_rawDescGZIP(), []int{4}
}
type SignOutResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *SignOutResponse) Reset() {
*x = SignOutResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v1_auth_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SignOutResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SignOutResponse) ProtoMessage() {}
func (x *SignOutResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_auth_service_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SignOutResponse.ProtoReflect.Descriptor instead.
func (*SignOutResponse) Descriptor() ([]byte, []int) {
return file_api_v1_auth_service_proto_rawDescGZIP(), []int{7}
} }
var File_api_v1_auth_service_proto protoreflect.FileDescriptor var File_api_v1_auth_service_proto protoreflect.FileDescriptor
@ -403,70 +291,70 @@ var file_api_v1_auth_service_proto_rawDesc = []byte{
0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69,
0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0x16, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x3f, 0x0a, 0x15, 0x47, 0x65, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x16, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x41, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x49,
0x0b, 0x32, 0x12, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69,
0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x41, 0x0a, 0x0d, 0x53, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a,
0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x5d, 0x0a, 0x0d, 0x53, 0x69,
0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x67, 0x6e, 0x55, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65,
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x38, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69,
0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
0x12, 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a,
0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x5d, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x68, 0x0a, 0x14, 0x53, 0x69, 0x67,
0x55, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x6e, 0x49, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x53, 0x53, 0x4f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x64, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x28, 0x05, 0x52, 0x07, 0x69, 0x64, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65,
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, 0x69,
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x38, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74,
0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x55, 0x72, 0x69, 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65,
0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x71, 0x75, 0x65, 0x73, 0x74, 0x32, 0xec, 0x03, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65,
0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x64, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68,
0x72, 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x22, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61,
0x65, 0x73, 0x74, 0x22, 0x11, 0x0a, 0x0f, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xae, 0x03, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x73, 0x6c, 0x61,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x75, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x1b,
0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x22, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, 0x13, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f,
0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x56, 0x0a, 0x06, 0x53,
0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x73, 0x6c, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x12, 0x1b, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70,
0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, 0x13, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, 0x13,
0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x60, 0x0a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73, 0x69, 0x67,
0x06, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x12, 0x1b, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x6e, 0x69, 0x6e, 0x12, 0x68, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x57, 0x69, 0x74,
0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x68, 0x53, 0x53, 0x4f, 0x12, 0x22, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x53, 0x53,
0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x4f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68,
0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, 0x13, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x1f, 0x82, 0xd3,
0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x12, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x17, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75,
0x60, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x12, 0x1b, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x74, 0x68, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x2f, 0x73, 0x73, 0x6f, 0x12, 0x56, 0x0a,
0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x52, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x12, 0x1b, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x52, 0x65, 0x71,
0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x55, 0x70, 0x52, 0x65, 0x73, 0x70, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, 0x13, 0x2f, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15,
0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x75, 0x22, 0x13, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73,
0x70, 0x12, 0x64, 0x0a, 0x07, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x75, 0x70, 0x12, 0x5d, 0x0a, 0x07, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74,
0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x1c, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e,
0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x6c, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, 0x14,
0x16, 0x22, 0x14, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x73, 0x69, 0x67,
0x73, 0x69, 0x67, 0x6e, 0x6f, 0x75, 0x74, 0x42, 0xae, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6e, 0x6f, 0x75, 0x74, 0x42, 0xae, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61,
0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x41, 0x75, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x41, 0x75, 0x74, 0x68, 0x53,
0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x67,
0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x6f, 0x75, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x6f, 0x75, 0x72, 0x73, 0x65,
0x72, 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x6c, 0x66, 0x68, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2f, 0x70,
0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b,
0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, 0xaa, 0x02, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x53, 0x6c,
0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x53, 0x6c, 0x61,
0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x53, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x53, 0x6c, 0x61, 0x73,
0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x41, 0x70,
0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -481,35 +369,32 @@ func file_api_v1_auth_service_proto_rawDescGZIP() []byte {
return file_api_v1_auth_service_proto_rawDescData return file_api_v1_auth_service_proto_rawDescData
} }
var file_api_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_api_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_api_v1_auth_service_proto_goTypes = []any{ var file_api_v1_auth_service_proto_goTypes = []any{
(*GetAuthStatusRequest)(nil), // 0: slash.api.v1.GetAuthStatusRequest (*GetAuthStatusRequest)(nil), // 0: slash.api.v1.GetAuthStatusRequest
(*GetAuthStatusResponse)(nil), // 1: slash.api.v1.GetAuthStatusResponse (*SignInRequest)(nil), // 1: slash.api.v1.SignInRequest
(*SignInRequest)(nil), // 2: slash.api.v1.SignInRequest (*SignUpRequest)(nil), // 2: slash.api.v1.SignUpRequest
(*SignInResponse)(nil), // 3: slash.api.v1.SignInResponse (*SignInWithSSORequest)(nil), // 3: slash.api.v1.SignInWithSSORequest
(*SignUpRequest)(nil), // 4: slash.api.v1.SignUpRequest (*SignOutRequest)(nil), // 4: slash.api.v1.SignOutRequest
(*SignUpResponse)(nil), // 5: slash.api.v1.SignUpResponse (*User)(nil), // 5: slash.api.v1.User
(*SignOutRequest)(nil), // 6: slash.api.v1.SignOutRequest (*emptypb.Empty)(nil), // 6: google.protobuf.Empty
(*SignOutResponse)(nil), // 7: slash.api.v1.SignOutResponse
(*User)(nil), // 8: slash.api.v1.User
} }
var file_api_v1_auth_service_proto_depIdxs = []int32{ var file_api_v1_auth_service_proto_depIdxs = []int32{
8, // 0: slash.api.v1.GetAuthStatusResponse.user:type_name -> slash.api.v1.User 0, // 0: slash.api.v1.AuthService.GetAuthStatus:input_type -> slash.api.v1.GetAuthStatusRequest
8, // 1: slash.api.v1.SignInResponse.user:type_name -> slash.api.v1.User 1, // 1: slash.api.v1.AuthService.SignIn:input_type -> slash.api.v1.SignInRequest
8, // 2: slash.api.v1.SignUpResponse.user:type_name -> slash.api.v1.User 3, // 2: slash.api.v1.AuthService.SignInWithSSO:input_type -> slash.api.v1.SignInWithSSORequest
0, // 3: slash.api.v1.AuthService.GetAuthStatus:input_type -> slash.api.v1.GetAuthStatusRequest 2, // 3: slash.api.v1.AuthService.SignUp:input_type -> slash.api.v1.SignUpRequest
2, // 4: slash.api.v1.AuthService.SignIn:input_type -> slash.api.v1.SignInRequest 4, // 4: slash.api.v1.AuthService.SignOut:input_type -> slash.api.v1.SignOutRequest
4, // 5: slash.api.v1.AuthService.SignUp:input_type -> slash.api.v1.SignUpRequest 5, // 5: slash.api.v1.AuthService.GetAuthStatus:output_type -> slash.api.v1.User
6, // 6: slash.api.v1.AuthService.SignOut:input_type -> slash.api.v1.SignOutRequest 5, // 6: slash.api.v1.AuthService.SignIn:output_type -> slash.api.v1.User
1, // 7: slash.api.v1.AuthService.GetAuthStatus:output_type -> slash.api.v1.GetAuthStatusResponse 5, // 7: slash.api.v1.AuthService.SignInWithSSO:output_type -> slash.api.v1.User
3, // 8: slash.api.v1.AuthService.SignIn:output_type -> slash.api.v1.SignInResponse 5, // 8: slash.api.v1.AuthService.SignUp:output_type -> slash.api.v1.User
5, // 9: slash.api.v1.AuthService.SignUp:output_type -> slash.api.v1.SignUpResponse 6, // 9: slash.api.v1.AuthService.SignOut:output_type -> google.protobuf.Empty
7, // 10: slash.api.v1.AuthService.SignOut:output_type -> slash.api.v1.SignOutResponse 5, // [5:10] is the sub-list for method output_type
7, // [7:11] is the sub-list for method output_type 0, // [0:5] is the sub-list for method input_type
3, // [3:7] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee
3, // [3:3] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name
0, // [0:3] is the sub-list for field type_name
} }
func init() { file_api_v1_auth_service_proto_init() } func init() { file_api_v1_auth_service_proto_init() }
@ -532,18 +417,6 @@ func file_api_v1_auth_service_proto_init() {
} }
} }
file_api_v1_auth_service_proto_msgTypes[1].Exporter = func(v any, i int) any { file_api_v1_auth_service_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*GetAuthStatusResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_api_v1_auth_service_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*SignInRequest); i { switch v := v.(*SignInRequest); i {
case 0: case 0:
return &v.state return &v.state
@ -555,19 +428,7 @@ func file_api_v1_auth_service_proto_init() {
return nil return nil
} }
} }
file_api_v1_auth_service_proto_msgTypes[3].Exporter = func(v any, i int) any { file_api_v1_auth_service_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*SignInResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_api_v1_auth_service_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*SignUpRequest); i { switch v := v.(*SignUpRequest); i {
case 0: case 0:
return &v.state return &v.state
@ -579,8 +440,8 @@ func file_api_v1_auth_service_proto_init() {
return nil return nil
} }
} }
file_api_v1_auth_service_proto_msgTypes[5].Exporter = func(v any, i int) any { file_api_v1_auth_service_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*SignUpResponse); i { switch v := v.(*SignInWithSSORequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -591,7 +452,7 @@ func file_api_v1_auth_service_proto_init() {
return nil return nil
} }
} }
file_api_v1_auth_service_proto_msgTypes[6].Exporter = func(v any, i int) any { file_api_v1_auth_service_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*SignOutRequest); i { switch v := v.(*SignOutRequest); i {
case 0: case 0:
return &v.state return &v.state
@ -603,18 +464,6 @@ func file_api_v1_auth_service_proto_init() {
return nil return nil
} }
} }
file_api_v1_auth_service_proto_msgTypes[7].Exporter = func(v any, i int) any {
switch v := v.(*SignOutResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@ -622,7 +471,7 @@ func file_api_v1_auth_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_v1_auth_service_proto_rawDesc, RawDescriptor: file_api_v1_auth_service_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 8, NumMessages: 5,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View File

@ -85,6 +85,42 @@ func local_request_AuthService_SignIn_0(ctx context.Context, marshaler runtime.M
} }
var (
filter_AuthService_SignInWithSSO_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_AuthService_SignInWithSSO_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq SignInWithSSORequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AuthService_SignInWithSSO_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.SignInWithSSO(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_AuthService_SignInWithSSO_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq SignInWithSSORequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AuthService_SignInWithSSO_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.SignInWithSSO(ctx, &protoReq)
return msg, metadata, err
}
var ( var (
filter_AuthService_SignUp_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} filter_AuthService_SignUp_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
) )
@ -196,6 +232,31 @@ func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
}) })
mux.Handle("POST", pattern_AuthService_SignInWithSSO_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v1.AuthService/SignInWithSSO", runtime.WithHTTPPathPattern("/api/v1/auth/signin/sso"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_AuthService_SignInWithSSO_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_SignInWithSSO_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_AuthService_SignUp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("POST", pattern_AuthService_SignUp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
@ -331,6 +392,28 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
}) })
mux.Handle("POST", pattern_AuthService_SignInWithSSO_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v1.AuthService/SignInWithSSO", runtime.WithHTTPPathPattern("/api/v1/auth/signin/sso"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_AuthService_SignInWithSSO_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_SignInWithSSO_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_AuthService_SignUp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("POST", pattern_AuthService_SignUp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
@ -383,6 +466,8 @@ var (
pattern_AuthService_SignIn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "auth", "signin"}, "")) pattern_AuthService_SignIn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "auth", "signin"}, ""))
pattern_AuthService_SignInWithSSO_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"api", "v1", "auth", "signin", "sso"}, ""))
pattern_AuthService_SignUp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "auth", "signup"}, "")) pattern_AuthService_SignUp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "auth", "signup"}, ""))
pattern_AuthService_SignOut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "auth", "signout"}, "")) pattern_AuthService_SignOut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "auth", "signout"}, ""))
@ -393,6 +478,8 @@ var (
forward_AuthService_SignIn_0 = runtime.ForwardResponseMessage forward_AuthService_SignIn_0 = runtime.ForwardResponseMessage
forward_AuthService_SignInWithSSO_0 = runtime.ForwardResponseMessage
forward_AuthService_SignUp_0 = runtime.ForwardResponseMessage forward_AuthService_SignUp_0 = runtime.ForwardResponseMessage
forward_AuthService_SignOut_0 = runtime.ForwardResponseMessage forward_AuthService_SignOut_0 = runtime.ForwardResponseMessage

View File

@ -11,6 +11,7 @@ import (
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
) )
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
@ -21,6 +22,7 @@ const _ = grpc.SupportPackageIsVersion9
const ( const (
AuthService_GetAuthStatus_FullMethodName = "/slash.api.v1.AuthService/GetAuthStatus" AuthService_GetAuthStatus_FullMethodName = "/slash.api.v1.AuthService/GetAuthStatus"
AuthService_SignIn_FullMethodName = "/slash.api.v1.AuthService/SignIn" AuthService_SignIn_FullMethodName = "/slash.api.v1.AuthService/SignIn"
AuthService_SignInWithSSO_FullMethodName = "/slash.api.v1.AuthService/SignInWithSSO"
AuthService_SignUp_FullMethodName = "/slash.api.v1.AuthService/SignUp" AuthService_SignUp_FullMethodName = "/slash.api.v1.AuthService/SignUp"
AuthService_SignOut_FullMethodName = "/slash.api.v1.AuthService/SignOut" AuthService_SignOut_FullMethodName = "/slash.api.v1.AuthService/SignOut"
) )
@ -29,10 +31,16 @@ const (
// //
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type AuthServiceClient interface { type AuthServiceClient interface {
GetAuthStatus(ctx context.Context, in *GetAuthStatusRequest, opts ...grpc.CallOption) (*GetAuthStatusResponse, error) // GetAuthStatus returns the current auth status of the user.
SignIn(ctx context.Context, in *SignInRequest, opts ...grpc.CallOption) (*SignInResponse, error) GetAuthStatus(ctx context.Context, in *GetAuthStatusRequest, opts ...grpc.CallOption) (*User, error)
SignUp(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*SignUpResponse, error) // SignIn signs in the user with the given username and password.
SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*SignOutResponse, error) SignIn(ctx context.Context, in *SignInRequest, opts ...grpc.CallOption) (*User, error)
// SignInWithSSO signs in the user with the given SSO code.
SignInWithSSO(ctx context.Context, in *SignInWithSSORequest, opts ...grpc.CallOption) (*User, error)
// SignUp signs up the user with the given username and password.
SignUp(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*User, error)
// SignOut signs out the user.
SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
} }
type authServiceClient struct { type authServiceClient struct {
@ -43,9 +51,9 @@ func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {
return &authServiceClient{cc} return &authServiceClient{cc}
} }
func (c *authServiceClient) GetAuthStatus(ctx context.Context, in *GetAuthStatusRequest, opts ...grpc.CallOption) (*GetAuthStatusResponse, error) { func (c *authServiceClient) GetAuthStatus(ctx context.Context, in *GetAuthStatusRequest, opts ...grpc.CallOption) (*User, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetAuthStatusResponse) out := new(User)
err := c.cc.Invoke(ctx, AuthService_GetAuthStatus_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, AuthService_GetAuthStatus_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -53,9 +61,9 @@ func (c *authServiceClient) GetAuthStatus(ctx context.Context, in *GetAuthStatus
return out, nil return out, nil
} }
func (c *authServiceClient) SignIn(ctx context.Context, in *SignInRequest, opts ...grpc.CallOption) (*SignInResponse, error) { func (c *authServiceClient) SignIn(ctx context.Context, in *SignInRequest, opts ...grpc.CallOption) (*User, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SignInResponse) out := new(User)
err := c.cc.Invoke(ctx, AuthService_SignIn_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, AuthService_SignIn_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -63,9 +71,19 @@ func (c *authServiceClient) SignIn(ctx context.Context, in *SignInRequest, opts
return out, nil return out, nil
} }
func (c *authServiceClient) SignUp(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*SignUpResponse, error) { func (c *authServiceClient) SignInWithSSO(ctx context.Context, in *SignInWithSSORequest, opts ...grpc.CallOption) (*User, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SignUpResponse) out := new(User)
err := c.cc.Invoke(ctx, AuthService_SignInWithSSO_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authServiceClient) SignUp(ctx context.Context, in *SignUpRequest, opts ...grpc.CallOption) (*User, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(User)
err := c.cc.Invoke(ctx, AuthService_SignUp_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, AuthService_SignUp_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -73,9 +91,9 @@ func (c *authServiceClient) SignUp(ctx context.Context, in *SignUpRequest, opts
return out, nil return out, nil
} }
func (c *authServiceClient) SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*SignOutResponse, error) { func (c *authServiceClient) SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SignOutResponse) out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, AuthService_SignOut_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, AuthService_SignOut_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -87,10 +105,16 @@ func (c *authServiceClient) SignOut(ctx context.Context, in *SignOutRequest, opt
// All implementations must embed UnimplementedAuthServiceServer // All implementations must embed UnimplementedAuthServiceServer
// for forward compatibility. // for forward compatibility.
type AuthServiceServer interface { type AuthServiceServer interface {
GetAuthStatus(context.Context, *GetAuthStatusRequest) (*GetAuthStatusResponse, error) // GetAuthStatus returns the current auth status of the user.
SignIn(context.Context, *SignInRequest) (*SignInResponse, error) GetAuthStatus(context.Context, *GetAuthStatusRequest) (*User, error)
SignUp(context.Context, *SignUpRequest) (*SignUpResponse, error) // SignIn signs in the user with the given username and password.
SignOut(context.Context, *SignOutRequest) (*SignOutResponse, error) SignIn(context.Context, *SignInRequest) (*User, error)
// SignInWithSSO signs in the user with the given SSO code.
SignInWithSSO(context.Context, *SignInWithSSORequest) (*User, error)
// SignUp signs up the user with the given username and password.
SignUp(context.Context, *SignUpRequest) (*User, error)
// SignOut signs out the user.
SignOut(context.Context, *SignOutRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedAuthServiceServer() mustEmbedUnimplementedAuthServiceServer()
} }
@ -101,16 +125,19 @@ type AuthServiceServer interface {
// pointer dereference when methods are called. // pointer dereference when methods are called.
type UnimplementedAuthServiceServer struct{} type UnimplementedAuthServiceServer struct{}
func (UnimplementedAuthServiceServer) GetAuthStatus(context.Context, *GetAuthStatusRequest) (*GetAuthStatusResponse, error) { func (UnimplementedAuthServiceServer) GetAuthStatus(context.Context, *GetAuthStatusRequest) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAuthStatus not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetAuthStatus not implemented")
} }
func (UnimplementedAuthServiceServer) SignIn(context.Context, *SignInRequest) (*SignInResponse, error) { func (UnimplementedAuthServiceServer) SignIn(context.Context, *SignInRequest) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method SignIn not implemented") return nil, status.Errorf(codes.Unimplemented, "method SignIn not implemented")
} }
func (UnimplementedAuthServiceServer) SignUp(context.Context, *SignUpRequest) (*SignUpResponse, error) { func (UnimplementedAuthServiceServer) SignInWithSSO(context.Context, *SignInWithSSORequest) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method SignInWithSSO not implemented")
}
func (UnimplementedAuthServiceServer) SignUp(context.Context, *SignUpRequest) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method SignUp not implemented") return nil, status.Errorf(codes.Unimplemented, "method SignUp not implemented")
} }
func (UnimplementedAuthServiceServer) SignOut(context.Context, *SignOutRequest) (*SignOutResponse, error) { func (UnimplementedAuthServiceServer) SignOut(context.Context, *SignOutRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method SignOut not implemented") return nil, status.Errorf(codes.Unimplemented, "method SignOut not implemented")
} }
func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {} func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
@ -170,6 +197,24 @@ func _AuthService_SignIn_Handler(srv interface{}, ctx context.Context, dec func(
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _AuthService_SignInWithSSO_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SignInWithSSORequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServiceServer).SignInWithSSO(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_SignInWithSSO_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).SignInWithSSO(ctx, req.(*SignInWithSSORequest))
}
return interceptor(ctx, in, info, handler)
}
func _AuthService_SignUp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _AuthService_SignUp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SignUpRequest) in := new(SignUpRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -221,6 +266,10 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{
MethodName: "SignIn", MethodName: "SignIn",
Handler: _AuthService_SignIn_Handler, Handler: _AuthService_SignIn_Handler,
}, },
{
MethodName: "SignInWithSSO",
Handler: _AuthService_SignInWithSSO_Handler,
},
{ {
MethodName: "SignUp", MethodName: "SignUp",
Handler: _AuthService_SignUp_Handler, Handler: _AuthService_SignUp_Handler,

View File

@ -17,12 +17,13 @@ produces:
paths: paths:
/api/v1/auth/signin: /api/v1/auth/signin:
post: post:
summary: SignIn signs in the user with the given username and password.
operationId: AuthService_SignIn operationId: AuthService_SignIn
responses: responses:
"200": "200":
description: A successful response. description: A successful response.
schema: schema:
$ref: '#/definitions/v1SignInResponse' $ref: '#/definitions/v1User'
default: default:
description: An unexpected error response. description: An unexpected error response.
schema: schema:
@ -38,14 +39,48 @@ paths:
type: string type: string
tags: tags:
- AuthService - AuthService
/api/v1/auth/signin/sso:
post:
summary: SignInWithSSO signs in the user with the given SSO code.
operationId: AuthService_SignInWithSSO
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1User'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/rpcStatus'
parameters:
- name: idpName
description: The name of the SSO provider.
in: query
required: false
type: integer
format: int32
- name: code
description: The code to sign in with.
in: query
required: false
type: string
- name: redirectUri
description: The redirect URI.
in: query
required: false
type: string
tags:
- AuthService
/api/v1/auth/signout: /api/v1/auth/signout:
post: post:
summary: SignOut signs out the user.
operationId: AuthService_SignOut operationId: AuthService_SignOut
responses: responses:
"200": "200":
description: A successful response. description: A successful response.
schema: schema:
$ref: '#/definitions/v1SignOutResponse' type: object
properties: {}
default: default:
description: An unexpected error response. description: An unexpected error response.
schema: schema:
@ -54,12 +89,13 @@ paths:
- AuthService - AuthService
/api/v1/auth/signup: /api/v1/auth/signup:
post: post:
summary: SignUp signs up the user with the given username and password.
operationId: AuthService_SignUp operationId: AuthService_SignUp
responses: responses:
"200": "200":
description: A successful response. description: A successful response.
schema: schema:
$ref: '#/definitions/v1SignUpResponse' $ref: '#/definitions/v1User'
default: default:
description: An unexpected error response. description: An unexpected error response.
schema: schema:
@ -81,12 +117,13 @@ paths:
- AuthService - AuthService
/api/v1/auth/status: /api/v1/auth/status:
post: post:
summary: GetAuthStatus returns the current auth status of the user.
operationId: AuthService_GetAuthStatus operationId: AuthService_GetAuthStatus
responses: responses:
"200": "200":
description: A successful response. description: A successful response.
schema: schema:
$ref: '#/definitions/v1GetAuthStatusResponse' $ref: '#/definitions/v1User'
default: default:
description: An unexpected error response. description: An unexpected error response.
schema: schema:
@ -961,11 +998,6 @@ definitions:
type: object type: object
v1DeleteUserResponse: v1DeleteUserResponse:
type: object type: object
v1GetAuthStatusResponse:
type: object
properties:
user:
$ref: '#/definitions/v1User'
v1GetCollectionByNameResponse: v1GetCollectionByNameResponse:
type: object type: object
properties: properties:
@ -1077,18 +1109,6 @@ definitions:
- ADMIN - ADMIN
- USER - USER
default: ROLE_UNSPECIFIED default: ROLE_UNSPECIFIED
v1SignInResponse:
type: object
properties:
user:
$ref: '#/definitions/v1User'
v1SignOutResponse:
type: object
v1SignUpResponse:
type: object
properties:
user:
$ref: '#/definitions/v1User'
v1Subscription: v1Subscription:
type: object type: object
properties: properties:

View File

@ -10,6 +10,7 @@ import (
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/emptypb"
v1pb "github.com/yourselfhosted/slash/proto/gen/api/v1" v1pb "github.com/yourselfhosted/slash/proto/gen/api/v1"
"github.com/yourselfhosted/slash/server/metric" "github.com/yourselfhosted/slash/server/metric"
@ -17,7 +18,7 @@ import (
"github.com/yourselfhosted/slash/store" "github.com/yourselfhosted/slash/store"
) )
func (s *APIV1Service) GetAuthStatus(ctx context.Context, _ *v1pb.GetAuthStatusRequest) (*v1pb.GetAuthStatusResponse, error) { func (s *APIV1Service) GetAuthStatus(ctx context.Context, _ *v1pb.GetAuthStatusRequest) (*v1pb.User, error) {
user, err := getCurrentUser(ctx, s.Store) user, err := getCurrentUser(ctx, s.Store)
if err != nil { if err != nil {
return nil, status.Errorf(codes.Unauthenticated, "failed to get current user: %v", err) return nil, status.Errorf(codes.Unauthenticated, "failed to get current user: %v", err)
@ -25,12 +26,10 @@ func (s *APIV1Service) GetAuthStatus(ctx context.Context, _ *v1pb.GetAuthStatusR
if user == nil { if user == nil {
return nil, status.Errorf(codes.Unauthenticated, "user not found") return nil, status.Errorf(codes.Unauthenticated, "user not found")
} }
return &v1pb.GetAuthStatusResponse{ return convertUserFromStore(user), nil
User: convertUserFromStore(user),
}, nil
} }
func (s *APIV1Service) SignIn(ctx context.Context, request *v1pb.SignInRequest) (*v1pb.SignInResponse, error) { func (s *APIV1Service) SignIn(ctx context.Context, request *v1pb.SignInRequest) (*v1pb.User, error) {
user, err := s.Store.GetUser(ctx, &store.FindUser{ user, err := s.Store.GetUser(ctx, &store.FindUser{
Email: &request.Email, Email: &request.Email,
}) })
@ -63,12 +62,10 @@ func (s *APIV1Service) SignIn(ctx context.Context, request *v1pb.SignInRequest)
} }
metric.Enqueue("user sign in") metric.Enqueue("user sign in")
return &v1pb.SignInResponse{ return convertUserFromStore(user), nil
User: convertUserFromStore(user),
}, nil
} }
func (s *APIV1Service) SignUp(ctx context.Context, request *v1pb.SignUpRequest) (*v1pb.SignUpResponse, error) { func (s *APIV1Service) SignUp(ctx context.Context, request *v1pb.SignUpRequest) (*v1pb.User, error) {
if !s.Profile.Public { if !s.Profile.Public {
return nil, status.Errorf(codes.PermissionDenied, "sign up is not allowed") return nil, status.Errorf(codes.PermissionDenied, "sign up is not allowed")
} }
@ -124,18 +121,15 @@ func (s *APIV1Service) SignUp(ctx context.Context, request *v1pb.SignUpRequest)
} }
metric.Enqueue("user sign up") metric.Enqueue("user sign up")
return &v1pb.SignUpResponse{ return convertUserFromStore(user), nil
User: convertUserFromStore(user),
}, nil
} }
func (*APIV1Service) SignOut(ctx context.Context, _ *v1pb.SignOutRequest) (*v1pb.SignOutResponse, error) { func (*APIV1Service) SignOut(ctx context.Context, _ *v1pb.SignOutRequest) (*emptypb.Empty, error) {
// Set the cookie header to expire access token. // Set the cookie header to expire access token.
if err := grpc.SetHeader(ctx, metadata.New(map[string]string{ if err := grpc.SetHeader(ctx, metadata.New(map[string]string{
"Set-Cookie": fmt.Sprintf("%s=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; SameSite=Strict", AccessTokenCookieName), "Set-Cookie": fmt.Sprintf("%s=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; SameSite=Strict", AccessTokenCookieName),
})); err != nil { })); err != nil {
return nil, status.Errorf(codes.Internal, "failed to set grpc header, error: %v", err) return nil, status.Errorf(codes.Internal, "failed to set grpc header, error: %v", err)
} }
return &emptypb.Empty{}, nil
return &v1pb.SignOutResponse{}, nil
} }