- Add comprehensive test file for internal/grpcserver package - Cover interceptors, system, engine, policy, and auth handlers - Cover pbToRule/ruleToPB conversion helpers - 37 tests total; CA/PKI/ACME and Login/Logout skipped (require live deps) Co-authored-by: Junie <junie@jetbrains.com>
390 lines
12 KiB
Go
390 lines
12 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-go v1.36.11
|
|
// protoc v3.20.3
|
|
// source: proto/metacrypt/v2/auth.proto
|
|
|
|
package metacryptv2
|
|
|
|
import (
|
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
|
reflect "reflect"
|
|
sync "sync"
|
|
unsafe "unsafe"
|
|
)
|
|
|
|
const (
|
|
// Verify that this generated code is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
|
)
|
|
|
|
type LoginRequest struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
|
|
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
|
|
TotpCode string `protobuf:"bytes,3,opt,name=totp_code,json=totpCode,proto3" json:"totp_code,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *LoginRequest) Reset() {
|
|
*x = LoginRequest{}
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *LoginRequest) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*LoginRequest) ProtoMessage() {}
|
|
|
|
func (x *LoginRequest) ProtoReflect() protoreflect.Message {
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[0]
|
|
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 LoginRequest.ProtoReflect.Descriptor instead.
|
|
func (*LoginRequest) Descriptor() ([]byte, []int) {
|
|
return file_proto_metacrypt_v2_auth_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *LoginRequest) GetUsername() string {
|
|
if x != nil {
|
|
return x.Username
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *LoginRequest) GetPassword() string {
|
|
if x != nil {
|
|
return x.Password
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *LoginRequest) GetTotpCode() string {
|
|
if x != nil {
|
|
return x.TotpCode
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type LoginResponse struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
|
|
ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *LoginResponse) Reset() {
|
|
*x = LoginResponse{}
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *LoginResponse) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*LoginResponse) ProtoMessage() {}
|
|
|
|
func (x *LoginResponse) ProtoReflect() protoreflect.Message {
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[1]
|
|
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 LoginResponse.ProtoReflect.Descriptor instead.
|
|
func (*LoginResponse) Descriptor() ([]byte, []int) {
|
|
return file_proto_metacrypt_v2_auth_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *LoginResponse) GetToken() string {
|
|
if x != nil {
|
|
return x.Token
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *LoginResponse) GetExpiresAt() *timestamppb.Timestamp {
|
|
if x != nil {
|
|
return x.ExpiresAt
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type LogoutRequest struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *LogoutRequest) Reset() {
|
|
*x = LogoutRequest{}
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[2]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *LogoutRequest) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*LogoutRequest) ProtoMessage() {}
|
|
|
|
func (x *LogoutRequest) ProtoReflect() protoreflect.Message {
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[2]
|
|
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 LogoutRequest.ProtoReflect.Descriptor instead.
|
|
func (*LogoutRequest) Descriptor() ([]byte, []int) {
|
|
return file_proto_metacrypt_v2_auth_proto_rawDescGZIP(), []int{2}
|
|
}
|
|
|
|
type LogoutResponse struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *LogoutResponse) Reset() {
|
|
*x = LogoutResponse{}
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[3]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *LogoutResponse) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*LogoutResponse) ProtoMessage() {}
|
|
|
|
func (x *LogoutResponse) ProtoReflect() protoreflect.Message {
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[3]
|
|
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 LogoutResponse.ProtoReflect.Descriptor instead.
|
|
func (*LogoutResponse) Descriptor() ([]byte, []int) {
|
|
return file_proto_metacrypt_v2_auth_proto_rawDescGZIP(), []int{3}
|
|
}
|
|
|
|
type TokenInfoRequest struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *TokenInfoRequest) Reset() {
|
|
*x = TokenInfoRequest{}
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[4]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *TokenInfoRequest) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*TokenInfoRequest) ProtoMessage() {}
|
|
|
|
func (x *TokenInfoRequest) ProtoReflect() protoreflect.Message {
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[4]
|
|
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 TokenInfoRequest.ProtoReflect.Descriptor instead.
|
|
func (*TokenInfoRequest) Descriptor() ([]byte, []int) {
|
|
return file_proto_metacrypt_v2_auth_proto_rawDescGZIP(), []int{4}
|
|
}
|
|
|
|
type TokenInfoResponse struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
|
|
Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"`
|
|
IsAdmin bool `protobuf:"varint,3,opt,name=is_admin,json=isAdmin,proto3" json:"is_admin,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *TokenInfoResponse) Reset() {
|
|
*x = TokenInfoResponse{}
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[5]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *TokenInfoResponse) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*TokenInfoResponse) ProtoMessage() {}
|
|
|
|
func (x *TokenInfoResponse) ProtoReflect() protoreflect.Message {
|
|
mi := &file_proto_metacrypt_v2_auth_proto_msgTypes[5]
|
|
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 TokenInfoResponse.ProtoReflect.Descriptor instead.
|
|
func (*TokenInfoResponse) Descriptor() ([]byte, []int) {
|
|
return file_proto_metacrypt_v2_auth_proto_rawDescGZIP(), []int{5}
|
|
}
|
|
|
|
func (x *TokenInfoResponse) GetUsername() string {
|
|
if x != nil {
|
|
return x.Username
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *TokenInfoResponse) GetRoles() []string {
|
|
if x != nil {
|
|
return x.Roles
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *TokenInfoResponse) GetIsAdmin() bool {
|
|
if x != nil {
|
|
return x.IsAdmin
|
|
}
|
|
return false
|
|
}
|
|
|
|
var File_proto_metacrypt_v2_auth_proto protoreflect.FileDescriptor
|
|
|
|
const file_proto_metacrypt_v2_auth_proto_rawDesc = "" +
|
|
"\n" +
|
|
"\x1dproto/metacrypt/v2/auth.proto\x12\fmetacrypt.v2\x1a\x1fgoogle/protobuf/timestamp.proto\"c\n" +
|
|
"\fLoginRequest\x12\x1a\n" +
|
|
"\busername\x18\x01 \x01(\tR\busername\x12\x1a\n" +
|
|
"\bpassword\x18\x02 \x01(\tR\bpassword\x12\x1b\n" +
|
|
"\ttotp_code\x18\x03 \x01(\tR\btotpCode\"`\n" +
|
|
"\rLoginResponse\x12\x14\n" +
|
|
"\x05token\x18\x01 \x01(\tR\x05token\x129\n" +
|
|
"\n" +
|
|
"expires_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt\"\x0f\n" +
|
|
"\rLogoutRequest\"\x10\n" +
|
|
"\x0eLogoutResponse\"\x12\n" +
|
|
"\x10TokenInfoRequest\"`\n" +
|
|
"\x11TokenInfoResponse\x12\x1a\n" +
|
|
"\busername\x18\x01 \x01(\tR\busername\x12\x14\n" +
|
|
"\x05roles\x18\x02 \x03(\tR\x05roles\x12\x19\n" +
|
|
"\bis_admin\x18\x03 \x01(\bR\aisAdmin2\xe2\x01\n" +
|
|
"\vAuthService\x12@\n" +
|
|
"\x05Login\x12\x1a.metacrypt.v2.LoginRequest\x1a\x1b.metacrypt.v2.LoginResponse\x12C\n" +
|
|
"\x06Logout\x12\x1b.metacrypt.v2.LogoutRequest\x1a\x1c.metacrypt.v2.LogoutResponse\x12L\n" +
|
|
"\tTokenInfo\x12\x1e.metacrypt.v2.TokenInfoRequest\x1a\x1f.metacrypt.v2.TokenInfoResponseB>Z<git.wntrmute.dev/kyle/metacrypt/gen/metacrypt/v2;metacryptv2b\x06proto3"
|
|
|
|
var (
|
|
file_proto_metacrypt_v2_auth_proto_rawDescOnce sync.Once
|
|
file_proto_metacrypt_v2_auth_proto_rawDescData []byte
|
|
)
|
|
|
|
func file_proto_metacrypt_v2_auth_proto_rawDescGZIP() []byte {
|
|
file_proto_metacrypt_v2_auth_proto_rawDescOnce.Do(func() {
|
|
file_proto_metacrypt_v2_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_metacrypt_v2_auth_proto_rawDesc), len(file_proto_metacrypt_v2_auth_proto_rawDesc)))
|
|
})
|
|
return file_proto_metacrypt_v2_auth_proto_rawDescData
|
|
}
|
|
|
|
var file_proto_metacrypt_v2_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
|
var file_proto_metacrypt_v2_auth_proto_goTypes = []any{
|
|
(*LoginRequest)(nil), // 0: metacrypt.v2.LoginRequest
|
|
(*LoginResponse)(nil), // 1: metacrypt.v2.LoginResponse
|
|
(*LogoutRequest)(nil), // 2: metacrypt.v2.LogoutRequest
|
|
(*LogoutResponse)(nil), // 3: metacrypt.v2.LogoutResponse
|
|
(*TokenInfoRequest)(nil), // 4: metacrypt.v2.TokenInfoRequest
|
|
(*TokenInfoResponse)(nil), // 5: metacrypt.v2.TokenInfoResponse
|
|
(*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp
|
|
}
|
|
var file_proto_metacrypt_v2_auth_proto_depIdxs = []int32{
|
|
6, // 0: metacrypt.v2.LoginResponse.expires_at:type_name -> google.protobuf.Timestamp
|
|
0, // 1: metacrypt.v2.AuthService.Login:input_type -> metacrypt.v2.LoginRequest
|
|
2, // 2: metacrypt.v2.AuthService.Logout:input_type -> metacrypt.v2.LogoutRequest
|
|
4, // 3: metacrypt.v2.AuthService.TokenInfo:input_type -> metacrypt.v2.TokenInfoRequest
|
|
1, // 4: metacrypt.v2.AuthService.Login:output_type -> metacrypt.v2.LoginResponse
|
|
3, // 5: metacrypt.v2.AuthService.Logout:output_type -> metacrypt.v2.LogoutResponse
|
|
5, // 6: metacrypt.v2.AuthService.TokenInfo:output_type -> metacrypt.v2.TokenInfoResponse
|
|
4, // [4:7] is the sub-list for method output_type
|
|
1, // [1:4] is the sub-list for method input_type
|
|
1, // [1:1] is the sub-list for extension type_name
|
|
1, // [1:1] is the sub-list for extension extendee
|
|
0, // [0:1] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_proto_metacrypt_v2_auth_proto_init() }
|
|
func file_proto_metacrypt_v2_auth_proto_init() {
|
|
if File_proto_metacrypt_v2_auth_proto != nil {
|
|
return
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_metacrypt_v2_auth_proto_rawDesc), len(file_proto_metacrypt_v2_auth_proto_rawDesc)),
|
|
NumEnums: 0,
|
|
NumMessages: 6,
|
|
NumExtensions: 0,
|
|
NumServices: 1,
|
|
},
|
|
GoTypes: file_proto_metacrypt_v2_auth_proto_goTypes,
|
|
DependencyIndexes: file_proto_metacrypt_v2_auth_proto_depIdxs,
|
|
MessageInfos: file_proto_metacrypt_v2_auth_proto_msgTypes,
|
|
}.Build()
|
|
File_proto_metacrypt_v2_auth_proto = out.File
|
|
file_proto_metacrypt_v2_auth_proto_goTypes = nil
|
|
file_proto_metacrypt_v2_auth_proto_depIdxs = nil
|
|
}
|