add refresh token api
This commit is contained in:
parent
ad43d206e1
commit
d3e3a66eca
|
@ -2722,6 +2722,7 @@ type LoginResponse struct {
|
|||
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
|
||||
Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
|
||||
Expires int64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"`
|
||||
RefreshToken string `protobuf:"bytes,5,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
@ -2784,6 +2785,133 @@ func (x *LoginResponse) GetExpires() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (x *LoginResponse) GetRefreshToken() string {
|
||||
if x != nil {
|
||||
return x.RefreshToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type RefreshTokenRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
RefreshToken string `protobuf:"bytes,1,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RefreshTokenRequest) Reset() {
|
||||
*x = RefreshTokenRequest{}
|
||||
mi := &file_organize_proto_msgTypes[47]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RefreshTokenRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RefreshTokenRequest) ProtoMessage() {}
|
||||
|
||||
func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_organize_proto_msgTypes[47]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RefreshTokenRequest.ProtoReflect.Descriptor instead.
|
||||
func (*RefreshTokenRequest) Descriptor() ([]byte, []int) {
|
||||
return file_organize_proto_rawDescGZIP(), []int{47}
|
||||
}
|
||||
|
||||
func (x *RefreshTokenRequest) GetRefreshToken() string {
|
||||
if x != nil {
|
||||
return x.RefreshToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type RefreshTokenResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
|
||||
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
|
||||
Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
|
||||
Expires int64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"`
|
||||
RefreshToken string `protobuf:"bytes,5,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RefreshTokenResponse) Reset() {
|
||||
*x = RefreshTokenResponse{}
|
||||
mi := &file_organize_proto_msgTypes[48]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RefreshTokenResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RefreshTokenResponse) ProtoMessage() {}
|
||||
|
||||
func (x *RefreshTokenResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_organize_proto_msgTypes[48]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RefreshTokenResponse.ProtoReflect.Descriptor instead.
|
||||
func (*RefreshTokenResponse) Descriptor() ([]byte, []int) {
|
||||
return file_organize_proto_rawDescGZIP(), []int{48}
|
||||
}
|
||||
|
||||
func (x *RefreshTokenResponse) GetUid() string {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RefreshTokenResponse) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RefreshTokenResponse) GetToken() string {
|
||||
if x != nil {
|
||||
return x.Token
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RefreshTokenResponse) GetExpires() int64 {
|
||||
if x != nil {
|
||||
return x.Expires
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RefreshTokenResponse) GetRefreshToken() string {
|
||||
if x != nil {
|
||||
return x.RefreshToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type LogoutRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
|
||||
|
@ -2793,7 +2921,7 @@ type LogoutRequest struct {
|
|||
|
||||
func (x *LogoutRequest) Reset() {
|
||||
*x = LogoutRequest{}
|
||||
mi := &file_organize_proto_msgTypes[47]
|
||||
mi := &file_organize_proto_msgTypes[49]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -2805,7 +2933,7 @@ func (x *LogoutRequest) String() string {
|
|||
func (*LogoutRequest) ProtoMessage() {}
|
||||
|
||||
func (x *LogoutRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_organize_proto_msgTypes[47]
|
||||
mi := &file_organize_proto_msgTypes[49]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -2818,7 +2946,7 @@ func (x *LogoutRequest) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use LogoutRequest.ProtoReflect.Descriptor instead.
|
||||
func (*LogoutRequest) Descriptor() ([]byte, []int) {
|
||||
return file_organize_proto_rawDescGZIP(), []int{47}
|
||||
return file_organize_proto_rawDescGZIP(), []int{49}
|
||||
}
|
||||
|
||||
func (x *LogoutRequest) GetToken() string {
|
||||
|
@ -2837,7 +2965,7 @@ type LogoutResponse struct {
|
|||
|
||||
func (x *LogoutResponse) Reset() {
|
||||
*x = LogoutResponse{}
|
||||
mi := &file_organize_proto_msgTypes[48]
|
||||
mi := &file_organize_proto_msgTypes[50]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -2849,7 +2977,7 @@ func (x *LogoutResponse) String() string {
|
|||
func (*LogoutResponse) ProtoMessage() {}
|
||||
|
||||
func (x *LogoutResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_organize_proto_msgTypes[48]
|
||||
mi := &file_organize_proto_msgTypes[50]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -2862,7 +2990,7 @@ func (x *LogoutResponse) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use LogoutResponse.ProtoReflect.Descriptor instead.
|
||||
func (*LogoutResponse) Descriptor() ([]byte, []int) {
|
||||
return file_organize_proto_rawDescGZIP(), []int{48}
|
||||
return file_organize_proto_rawDescGZIP(), []int{50}
|
||||
}
|
||||
|
||||
func (x *LogoutResponse) GetUid() string {
|
||||
|
@ -3137,12 +3265,21 @@ const file_organize_proto_rawDesc = "" +
|
|||
"\fLoginRequest\x12\x1a\n" +
|
||||
"\busername\x18\x01 \x01(\tR\busername\x12\x1a\n" +
|
||||
"\bpassword\x18\x02 \x01(\tR\bpassword\x12\x14\n" +
|
||||
"\x05token\x18\x03 \x01(\tR\x05token\"m\n" +
|
||||
"\x05token\x18\x03 \x01(\tR\x05token\"\x92\x01\n" +
|
||||
"\rLoginResponse\x12\x10\n" +
|
||||
"\x03uid\x18\x01 \x01(\tR\x03uid\x12\x1a\n" +
|
||||
"\busername\x18\x02 \x01(\tR\busername\x12\x14\n" +
|
||||
"\x05token\x18\x03 \x01(\tR\x05token\x12\x18\n" +
|
||||
"\aexpires\x18\x04 \x01(\x03R\aexpires\"%\n" +
|
||||
"\aexpires\x18\x04 \x01(\x03R\aexpires\x12#\n" +
|
||||
"\rrefresh_token\x18\x05 \x01(\tR\frefreshToken\":\n" +
|
||||
"\x13RefreshTokenRequest\x12#\n" +
|
||||
"\rrefresh_token\x18\x01 \x01(\tR\frefreshToken\"\x99\x01\n" +
|
||||
"\x14RefreshTokenResponse\x12\x10\n" +
|
||||
"\x03uid\x18\x01 \x01(\tR\x03uid\x12\x1a\n" +
|
||||
"\busername\x18\x02 \x01(\tR\busername\x12\x14\n" +
|
||||
"\x05token\x18\x03 \x01(\tR\x05token\x12\x18\n" +
|
||||
"\aexpires\x18\x04 \x01(\x03R\aexpires\x12#\n" +
|
||||
"\rrefresh_token\x18\x05 \x01(\tR\frefreshToken\"%\n" +
|
||||
"\rLogoutRequest\x12\x14\n" +
|
||||
"\x05token\x18\x01 \x01(\tR\x05token\"\"\n" +
|
||||
"\x0eLogoutResponse\x12\x10\n" +
|
||||
|
@ -3168,10 +3305,11 @@ const file_organize_proto_rawDesc = "" +
|
|||
"\vMenuService\x12S\n" +
|
||||
"\bGetMenus\x12\x18.organize.GetMenuRequest\x1a\x19.organize.GetMenuResponse\"\x12\x82\xd3\xe4\x93\x02\f\x12\n" +
|
||||
"/menu/list\x12{\n" +
|
||||
"\x12GetMenuLevelLabels\x12#.organize.GetMenuLevelLabelsRequest\x1a$.organize.GetMenuLevelLabelsResponse\"\x1a\x82\xd3\xe4\x93\x02\x14\x12\x12/menu/level-labels2\xbd\x01\n" +
|
||||
"\x12GetMenuLevelLabels\x12#.organize.GetMenuLevelLabelsRequest\x1a$.organize.GetMenuLevelLabelsResponse\"\x1a\x82\xd3\xe4\x93\x02\x14\x12\x12/menu/level-labels2\xb0\x02\n" +
|
||||
"\vAuthService\x12T\n" +
|
||||
"\x05Login\x12\x16.organize.LoginRequest\x1a\x17.organize.LoginResponse\"\x1a\x82\xd3\xe4\x93\x02\x14:\x01*\"\x0f/passport/login\x12X\n" +
|
||||
"\x06Logout\x12\x17.organize.LogoutRequest\x1a\x18.organize.LogoutResponse\"\x1b\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/passport/logoutB&Z$git.nobla.cn/golang/aeis-admin/pb;pbb\x06proto3"
|
||||
"\x06Logout\x12\x17.organize.LogoutRequest\x1a\x18.organize.LogoutResponse\"\x1b\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/passport/logout\x12q\n" +
|
||||
"\fRefreshToken\x12\x1d.organize.RefreshTokenRequest\x1a\x1e.organize.RefreshTokenResponse\"\"\x82\xd3\xe4\x93\x02\x1c:\x01*\"\x17/passport/refresh-tokenB&Z$git.nobla.cn/golang/aeis-admin/pb;pbb\x06proto3"
|
||||
|
||||
var (
|
||||
file_organize_proto_rawDescOnce sync.Once
|
||||
|
@ -3185,7 +3323,7 @@ func file_organize_proto_rawDescGZIP() []byte {
|
|||
return file_organize_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_organize_proto_msgTypes = make([]protoimpl.MessageInfo, 49)
|
||||
var file_organize_proto_msgTypes = make([]protoimpl.MessageInfo, 51)
|
||||
var file_organize_proto_goTypes = []any{
|
||||
(*Menu)(nil), // 0: organize.Menu
|
||||
(*Role)(nil), // 1: organize.Role
|
||||
|
@ -3234,8 +3372,10 @@ var file_organize_proto_goTypes = []any{
|
|||
(*GetMenuResponse)(nil), // 44: organize.GetMenuResponse
|
||||
(*LoginRequest)(nil), // 45: organize.LoginRequest
|
||||
(*LoginResponse)(nil), // 46: organize.LoginResponse
|
||||
(*LogoutRequest)(nil), // 47: organize.LogoutRequest
|
||||
(*LogoutResponse)(nil), // 48: organize.LogoutResponse
|
||||
(*RefreshTokenRequest)(nil), // 47: organize.RefreshTokenRequest
|
||||
(*RefreshTokenResponse)(nil), // 48: organize.RefreshTokenResponse
|
||||
(*LogoutRequest)(nil), // 49: organize.LogoutRequest
|
||||
(*LogoutResponse)(nil), // 50: organize.LogoutResponse
|
||||
}
|
||||
var file_organize_proto_depIdxs = []int32{
|
||||
8, // 0: organize.MenuItem.permissions:type_name -> organize.PermissionItem
|
||||
|
@ -3269,26 +3409,28 @@ var file_organize_proto_depIdxs = []int32{
|
|||
43, // 28: organize.MenuService.GetMenus:input_type -> organize.GetMenuRequest
|
||||
40, // 29: organize.MenuService.GetMenuLevelLabels:input_type -> organize.GetMenuLevelLabelsRequest
|
||||
45, // 30: organize.AuthService.Login:input_type -> organize.LoginRequest
|
||||
47, // 31: organize.AuthService.Logout:input_type -> organize.LogoutRequest
|
||||
11, // 32: organize.UserService.GetMenus:output_type -> organize.GetUserMenuResponse
|
||||
13, // 33: organize.UserService.GetProfile:output_type -> organize.GetProfileResponse
|
||||
17, // 34: organize.UserService.UpdateProfile:output_type -> organize.UpdateProfileResponse
|
||||
15, // 35: organize.UserService.ResetPassword:output_type -> organize.ResetPasswordResponse
|
||||
19, // 36: organize.UserService.GetPermissions:output_type -> organize.GetPermissionResponse
|
||||
21, // 37: organize.UserService.GetUserLabels:output_type -> organize.GetUserLabelResponse
|
||||
23, // 38: organize.UserService.GetUserTags:output_type -> organize.GetUserTagResponse
|
||||
27, // 39: organize.DepartmentService.GetDepartmentLabels:output_type -> organize.GetDepartmentLabelResponse
|
||||
29, // 40: organize.DepartmentService.GetDepartmentUsers:output_type -> organize.GetDepartmentUserResponse
|
||||
32, // 41: organize.DepartmentService.GetDepartmentLevelLabels:output_type -> organize.GetDepartmentLevelLabelsResponse
|
||||
34, // 42: organize.RoleService.GetRoleLabels:output_type -> organize.GetRoleLabelResponse
|
||||
36, // 43: organize.RoleService.GetRolePermissions:output_type -> organize.GetRolePermissionResponse
|
||||
38, // 44: organize.RoleService.SaveRolePermission:output_type -> organize.SaveRolePermissionResponse
|
||||
44, // 45: organize.MenuService.GetMenus:output_type -> organize.GetMenuResponse
|
||||
41, // 46: organize.MenuService.GetMenuLevelLabels:output_type -> organize.GetMenuLevelLabelsResponse
|
||||
46, // 47: organize.AuthService.Login:output_type -> organize.LoginResponse
|
||||
48, // 48: organize.AuthService.Logout:output_type -> organize.LogoutResponse
|
||||
32, // [32:49] is the sub-list for method output_type
|
||||
15, // [15:32] is the sub-list for method input_type
|
||||
49, // 31: organize.AuthService.Logout:input_type -> organize.LogoutRequest
|
||||
47, // 32: organize.AuthService.RefreshToken:input_type -> organize.RefreshTokenRequest
|
||||
11, // 33: organize.UserService.GetMenus:output_type -> organize.GetUserMenuResponse
|
||||
13, // 34: organize.UserService.GetProfile:output_type -> organize.GetProfileResponse
|
||||
17, // 35: organize.UserService.UpdateProfile:output_type -> organize.UpdateProfileResponse
|
||||
15, // 36: organize.UserService.ResetPassword:output_type -> organize.ResetPasswordResponse
|
||||
19, // 37: organize.UserService.GetPermissions:output_type -> organize.GetPermissionResponse
|
||||
21, // 38: organize.UserService.GetUserLabels:output_type -> organize.GetUserLabelResponse
|
||||
23, // 39: organize.UserService.GetUserTags:output_type -> organize.GetUserTagResponse
|
||||
27, // 40: organize.DepartmentService.GetDepartmentLabels:output_type -> organize.GetDepartmentLabelResponse
|
||||
29, // 41: organize.DepartmentService.GetDepartmentUsers:output_type -> organize.GetDepartmentUserResponse
|
||||
32, // 42: organize.DepartmentService.GetDepartmentLevelLabels:output_type -> organize.GetDepartmentLevelLabelsResponse
|
||||
34, // 43: organize.RoleService.GetRoleLabels:output_type -> organize.GetRoleLabelResponse
|
||||
36, // 44: organize.RoleService.GetRolePermissions:output_type -> organize.GetRolePermissionResponse
|
||||
38, // 45: organize.RoleService.SaveRolePermission:output_type -> organize.SaveRolePermissionResponse
|
||||
44, // 46: organize.MenuService.GetMenus:output_type -> organize.GetMenuResponse
|
||||
41, // 47: organize.MenuService.GetMenuLevelLabels:output_type -> organize.GetMenuLevelLabelsResponse
|
||||
46, // 48: organize.AuthService.Login:output_type -> organize.LoginResponse
|
||||
50, // 49: organize.AuthService.Logout:output_type -> organize.LogoutResponse
|
||||
48, // 50: organize.AuthService.RefreshToken:output_type -> organize.RefreshTokenResponse
|
||||
33, // [33:51] is the sub-list for method output_type
|
||||
15, // [15:33] is the sub-list for method input_type
|
||||
15, // [15:15] is the sub-list for extension type_name
|
||||
15, // [15:15] is the sub-list for extension extendee
|
||||
0, // [0:15] is the sub-list for field type_name
|
||||
|
@ -3305,7 +3447,7 @@ func file_organize_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_organize_proto_rawDesc), len(file_organize_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 49,
|
||||
NumMessages: 51,
|
||||
NumExtensions: 0,
|
||||
NumServices: 5,
|
||||
},
|
||||
|
|
|
@ -5663,6 +5663,8 @@ func (m *LoginResponse) validate(all bool) error {
|
|||
|
||||
// no validation rules for Expires
|
||||
|
||||
// no validation rules for RefreshToken
|
||||
|
||||
if len(errors) > 0 {
|
||||
return LoginResponseMultiError(errors)
|
||||
}
|
||||
|
@ -5741,6 +5743,222 @@ var _ interface {
|
|||
ErrorName() string
|
||||
} = LoginResponseValidationError{}
|
||||
|
||||
// Validate checks the field values on RefreshTokenRequest with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *RefreshTokenRequest) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on RefreshTokenRequest with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// RefreshTokenRequestMultiError, or nil if none found.
|
||||
func (m *RefreshTokenRequest) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *RefreshTokenRequest) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for RefreshToken
|
||||
|
||||
if len(errors) > 0 {
|
||||
return RefreshTokenRequestMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RefreshTokenRequestMultiError is an error wrapping multiple validation
|
||||
// errors returned by RefreshTokenRequest.ValidateAll() if the designated
|
||||
// constraints aren't met.
|
||||
type RefreshTokenRequestMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m RefreshTokenRequestMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m RefreshTokenRequestMultiError) AllErrors() []error { return m }
|
||||
|
||||
// RefreshTokenRequestValidationError is the validation error returned by
|
||||
// RefreshTokenRequest.Validate if the designated constraints aren't met.
|
||||
type RefreshTokenRequestValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e RefreshTokenRequestValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e RefreshTokenRequestValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e RefreshTokenRequestValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e RefreshTokenRequestValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e RefreshTokenRequestValidationError) ErrorName() string {
|
||||
return "RefreshTokenRequestValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e RefreshTokenRequestValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sRefreshTokenRequest.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = RefreshTokenRequestValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = RefreshTokenRequestValidationError{}
|
||||
|
||||
// Validate checks the field values on RefreshTokenResponse with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *RefreshTokenResponse) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on RefreshTokenResponse with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// RefreshTokenResponseMultiError, or nil if none found.
|
||||
func (m *RefreshTokenResponse) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *RefreshTokenResponse) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for Uid
|
||||
|
||||
// no validation rules for Username
|
||||
|
||||
// no validation rules for Token
|
||||
|
||||
// no validation rules for Expires
|
||||
|
||||
// no validation rules for RefreshToken
|
||||
|
||||
if len(errors) > 0 {
|
||||
return RefreshTokenResponseMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RefreshTokenResponseMultiError is an error wrapping multiple validation
|
||||
// errors returned by RefreshTokenResponse.ValidateAll() if the designated
|
||||
// constraints aren't met.
|
||||
type RefreshTokenResponseMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m RefreshTokenResponseMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m RefreshTokenResponseMultiError) AllErrors() []error { return m }
|
||||
|
||||
// RefreshTokenResponseValidationError is the validation error returned by
|
||||
// RefreshTokenResponse.Validate if the designated constraints aren't met.
|
||||
type RefreshTokenResponseValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e RefreshTokenResponseValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e RefreshTokenResponseValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e RefreshTokenResponseValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e RefreshTokenResponseValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e RefreshTokenResponseValidationError) ErrorName() string {
|
||||
return "RefreshTokenResponseValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e RefreshTokenResponseValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sRefreshTokenResponse.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = RefreshTokenResponseValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = RefreshTokenResponseValidationError{}
|
||||
|
||||
// Validate checks the field values on LogoutRequest with the rules defined in
|
||||
// the proto definition for this message. If any rules are violated, the first
|
||||
// error encountered is returned, or nil if there are no violations.
|
||||
|
|
|
@ -418,6 +418,19 @@ message LoginResponse {
|
|||
string username = 2;
|
||||
string token = 3;
|
||||
int64 expires = 4;
|
||||
string refresh_token = 5;
|
||||
}
|
||||
|
||||
message RefreshTokenRequest {
|
||||
string refresh_token = 1;
|
||||
}
|
||||
|
||||
message RefreshTokenResponse {
|
||||
string uid = 1;
|
||||
string username = 2;
|
||||
string token = 3;
|
||||
int64 expires = 4;
|
||||
string refresh_token = 5;
|
||||
}
|
||||
|
||||
message LogoutRequest {
|
||||
|
@ -442,4 +455,10 @@ service AuthService {
|
|||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/passport/refresh-token"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -869,8 +869,9 @@ var MenuService_ServiceDesc = grpc.ServiceDesc{
|
|||
}
|
||||
|
||||
const (
|
||||
AuthService_Login_FullMethodName = "/organize.AuthService/Login"
|
||||
AuthService_Logout_FullMethodName = "/organize.AuthService/Logout"
|
||||
AuthService_Login_FullMethodName = "/organize.AuthService/Login"
|
||||
AuthService_Logout_FullMethodName = "/organize.AuthService/Logout"
|
||||
AuthService_RefreshToken_FullMethodName = "/organize.AuthService/RefreshToken"
|
||||
)
|
||||
|
||||
// AuthServiceClient is the client API for AuthService service.
|
||||
|
@ -881,6 +882,7 @@ const (
|
|||
type AuthServiceClient interface {
|
||||
Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
|
||||
Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*LogoutResponse, error)
|
||||
RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*RefreshTokenResponse, error)
|
||||
}
|
||||
|
||||
type authServiceClient struct {
|
||||
|
@ -911,6 +913,16 @@ func (c *authServiceClient) Logout(ctx context.Context, in *LogoutRequest, opts
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *authServiceClient) RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*RefreshTokenResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RefreshTokenResponse)
|
||||
err := c.cc.Invoke(ctx, AuthService_RefreshToken_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// AuthServiceServer is the server API for AuthService service.
|
||||
// All implementations must embed UnimplementedAuthServiceServer
|
||||
// for forward compatibility.
|
||||
|
@ -919,6 +931,7 @@ func (c *authServiceClient) Logout(ctx context.Context, in *LogoutRequest, opts
|
|||
type AuthServiceServer interface {
|
||||
Login(context.Context, *LoginRequest) (*LoginResponse, error)
|
||||
Logout(context.Context, *LogoutRequest) (*LogoutResponse, error)
|
||||
RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error)
|
||||
mustEmbedUnimplementedAuthServiceServer()
|
||||
}
|
||||
|
||||
|
@ -935,6 +948,9 @@ func (UnimplementedAuthServiceServer) Login(context.Context, *LoginRequest) (*Lo
|
|||
func (UnimplementedAuthServiceServer) Logout(context.Context, *LogoutRequest) (*LogoutResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented")
|
||||
}
|
||||
func (UnimplementedAuthServiceServer) RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RefreshToken not implemented")
|
||||
}
|
||||
func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
|
||||
func (UnimplementedAuthServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
|
@ -992,6 +1008,24 @@ func _AuthService_Logout_Handler(srv interface{}, ctx context.Context, dec func(
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AuthService_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RefreshTokenRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthServiceServer).RefreshToken(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthService_RefreshToken_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthServiceServer).RefreshToken(ctx, req.(*RefreshTokenRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
@ -1007,6 +1041,10 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "Logout",
|
||||
Handler: _AuthService_Logout_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RefreshToken",
|
||||
Handler: _AuthService_RefreshToken_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "organize.proto",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||
// source: organize.proto
|
||||
// date: 2025-07-22 16:59:46
|
||||
// date: 2025-07-22 18:30:59
|
||||
|
||||
package pb
|
||||
|
||||
|
@ -65,6 +65,8 @@ type AuthServiceHttpServer interface {
|
|||
Login(ctx context.Context, req *LoginRequest) (res *LoginResponse, err error)
|
||||
|
||||
Logout(ctx context.Context, req *LogoutRequest) (res *LogoutResponse, err error)
|
||||
|
||||
RefreshToken(ctx context.Context, req *RefreshTokenRequest) (res *RefreshTokenResponse, err error)
|
||||
}
|
||||
|
||||
// 获取用户菜单
|
||||
|
@ -367,6 +369,24 @@ func handleAuthServiceLogout(s AuthServiceHttpServer) http.HandleFunc {
|
|||
}
|
||||
}
|
||||
|
||||
func handleAuthServiceRefreshToken(s AuthServiceHttpServer) http.HandleFunc {
|
||||
return func(ctx *http.Context) (err error) {
|
||||
req := &RefreshTokenRequest{}
|
||||
if err := ctx.Bind(req); err != nil {
|
||||
return ctx.Error(errors.Invalid, err.Error())
|
||||
}
|
||||
if res, err := s.RefreshToken(ctx.Context(), req); err != nil {
|
||||
if er, ok := err.(*errors.Error); ok {
|
||||
return ctx.Error(er.Code, er.Message)
|
||||
} else {
|
||||
return ctx.Error(errors.Unavailable, err.Error())
|
||||
}
|
||||
} else {
|
||||
return ctx.Success(res)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func RegisterUserServiceRouter(hs *http.Server, s UserServiceHttpServer) {
|
||||
|
||||
// Register handle GetMenus route
|
||||
|
@ -436,4 +456,7 @@ func RegisterAuthServiceRouter(hs *http.Server, s AuthServiceHttpServer) {
|
|||
// Register handle Logout route
|
||||
hs.POST("/passport/logout", handleAuthServiceLogout(s))
|
||||
|
||||
// Register handle RefreshToken route
|
||||
hs.POST("/passport/refresh-token", handleAuthServiceRefreshToken(s))
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||
// source: organize.proto
|
||||
// date: 2025-07-22 16:59:46
|
||||
// date: 2025-07-22 18:30:59
|
||||
|
||||
package pb
|
||||
|
||||
|
|
|
@ -355,23 +355,23 @@ var File_system_proto protoreflect.FileDescriptor
|
|||
|
||||
const file_system_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\fsystem.proto\x12\x06system\x1a\x0faeus/rest.proto\x1a\x17validate/validate.proto\x1a google/protobuf/descriptor.proto\x1a\x1cgoogle/api/annotations.proto\"\xc0\x04\n" +
|
||||
"\fsystem.proto\x12\x06system\x1a\x0faeus/rest.proto\x1a\x17validate/validate.proto\x1a google/protobuf/descriptor.proto\x1a\x1cgoogle/api/annotations.proto\"\xb7\x04\n" +
|
||||
"\aSetting\x12$\n" +
|
||||
"\x02id\x18\x01 \x01(\x03B\x14\xb2\xb9\x19\x10\n" +
|
||||
"\n" +
|
||||
"primaryKey\x12\x02IDR\x02id\x12E\n" +
|
||||
"primaryKey\x12\x02IDR\x02id\x12>\n" +
|
||||
"\n" +
|
||||
"created_at\x18\x02 \x01(\x03B&\xb2\xb9\x19\"\x12\f创建时间\x1a\x12search;view;exportR\tcreatedAt\x12E\n" +
|
||||
"created_at\x18\x02 \x01(\x03B\x1f\xb2\xb9\x19\x1b\x12\f创建时间\x1a\vview;exportR\tcreatedAt\x12>\n" +
|
||||
"\n" +
|
||||
"updated_at\x18\x03 \x01(\x03B&\xb2\xb9\x19\"\x12\f更新时间\x1a\x12search;view;exportR\tupdatedAt\x12N\n" +
|
||||
"updated_at\x18\x03 \x01(\x03B\x1f\xb2\xb9\x19\x1b\x12\f更新时间\x1a\vview;exportR\tupdatedAt\x12N\n" +
|
||||
"\x04name\x18\x04 \x01(\tB:\xfaB\x04r\x02\x18\x14\xb2\xb9\x19/\n" +
|
||||
"\asize:60\x12\t配置项2\x0freadonly:update:\brequiredR\x04name\x12e\n" +
|
||||
"\x04type\x18\x05 \x01(\tBQ\xfaB\x04r\x02\x18\x14\xb2\xb9\x19F\n" +
|
||||
"\asize:20\x12\f数据类型:\brequiredR#text:文本;number:数字;json:JSONR\x04type\x12L\n" +
|
||||
"\x05value\x18\x06 \x01(\tB6\xfaB\x05r\x03\x18\x80\b\xb2\xb9\x19*\n" +
|
||||
"\tsize:1024\x12\t配置值*\btextarea:\brequiredR\x05value\x12l\n" +
|
||||
"\vdescription\x18\a \x01(\tBJ\xfaB\x05r\x03\x18\x80\b\xb2\xb9\x19>\n" +
|
||||
"\tsize:1024\x12\f备注说明\x1a\x19create;update;view;export*\btextareaR\vdescription:\x0e\xba\xb9\x19\n" +
|
||||
"\tsize:1024\x12\t配置值*\btextarea:\brequiredR\x05value\x12q\n" +
|
||||
"\vdescription\x18\a \x01(\tBO\xfaB\x05r\x03\x18\x80\b\xb2\xb9\x19C\n" +
|
||||
"\tsize:1024\x12\f备注说明\x1a\x1elist;create;update;view;export*\btextareaR\vdescription:\x0e\xba\xb9\x19\n" +
|
||||
"\n" +
|
||||
"\bsettings\"\xe2\x05\n" +
|
||||
"\bActivity\x12$\n" +
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||
// source: system.proto
|
||||
// date: 2025-07-22 16:59:46
|
||||
// date: 2025-07-22 18:30:59
|
||||
|
||||
package pb
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
||||
// source: system.proto
|
||||
// date: 2025-07-22 16:59:46
|
||||
// date: 2025-07-22 18:30:59
|
||||
|
||||
package pb
|
||||
|
||||
|
@ -10,12 +10,12 @@ import (
|
|||
|
||||
type SettingModel struct {
|
||||
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"ID"`
|
||||
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"search;view;export"`
|
||||
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"column:updated_at" comment:"更新时间" scenarios:"search;view;export"`
|
||||
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"`
|
||||
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"column:updated_at" comment:"更新时间" scenarios:"view;export"`
|
||||
Name string `json:"name" yaml:"name" xml:"name" gorm:"size:60;column:name" comment:"配置项" props:"readonly:update" rule:"required"`
|
||||
Type string `json:"type" yaml:"type" xml:"type" gorm:"size:20;column:type" comment:"数据类型" rule:"required" enum:"text:文本;number:数字;json:JSON"`
|
||||
Value string `json:"value" yaml:"value" xml:"value" gorm:"size:1024;column:value" comment:"配置值" format:"textarea" rule:"required"`
|
||||
Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"create;update;view;export" format:"textarea"`
|
||||
Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"list;create;update;view;export" format:"textarea"`
|
||||
}
|
||||
|
||||
func (m *SettingModel) TableName() string {
|
||||
|
|
Loading…
Reference in New Issue