diff --git a/cmd/root.go b/cmd/root.go index aba57b66..89eb1648 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -3,8 +3,10 @@ package cmd import ( "context" "fmt" + "net" "os" "os/signal" + "strconv" "strings" "time" @@ -25,6 +27,7 @@ import ( "github.com/authorizerdev/authorizer/internal/memory_store" "github.com/authorizerdev/authorizer/internal/metrics" "github.com/authorizerdev/authorizer/internal/oauth" + "github.com/authorizerdev/authorizer/internal/grpcsrv" "github.com/authorizerdev/authorizer/internal/rate_limit" "github.com/authorizerdev/authorizer/internal/server" "github.com/authorizerdev/authorizer/internal/service" @@ -103,6 +106,13 @@ func init() { f.IntVar(&rootArgs.config.GraphQLMaxAliases, "graphql-max-aliases", 30, "Maximum total number of aliased fields per GraphQL operation") f.Int64Var(&rootArgs.config.GraphQLMaxBodyBytes, "graphql-max-body-bytes", 1<<20, "Maximum allowed GraphQL request body size in bytes (default 1MB)") + // gRPC server flags + f.IntVar(&rootArgs.config.GRPCPort, "grpc-port", 8081, "Port the gRPC server listens on") + f.BoolVar(&rootArgs.config.EnableGRPCReflection, "enable-grpc-reflection", true, "Enable the gRPC server-reflection service") + f.StringVar(&rootArgs.config.GRPCTLSCert, "grpc-tls-cert", "", "Path to the TLS certificate for the gRPC server") + f.StringVar(&rootArgs.config.GRPCTLSKey, "grpc-tls-key", "", "Path to the TLS private key for the gRPC server") + f.BoolVar(&rootArgs.config.GRPCInsecure, "grpc-insecure", false, "Allow the gRPC server to run without TLS (dev only)") + // Organization flags f.StringVar(&rootArgs.config.OrganizationLogo, "organization-logo", defaultOrganizationLogo, "Logo of the organization") f.StringVar(&rootArgs.config.OrganizationName, "organization-name", defaultOrganizationName, "Name of the organization") @@ -566,11 +576,27 @@ func runRoot(c *cobra.Command, args []string) { if err != nil { log.Fatal().Err(err).Msg("failed to create http provider") } + + // gRPC server — listens on --grpc-port. The REST gateway built by + // server.Run wraps this same gRPC server in-process so /v1/* REST + // calls translate to local gRPC method invocations (no network hop). + grpcAddr := net.JoinHostPort(rootArgs.server.Host, strconv.Itoa(rootArgs.config.GRPCPort)) + grpcSrv, err := grpcsrv.New(grpcAddr, &grpcsrv.Dependencies{ + Log: &log, + Config: &rootArgs.config, + ServiceProvider: serviceProvider, + }) + if err != nil { + log.Fatal().Err(err).Msg("failed to create grpc server") + } + rootArgs.server.GRPCPort = rootArgs.config.GRPCPort + // Prepare server deps := &server.Dependencies{ Log: &log, AppConfig: &rootArgs.config, HTTPProvider: httpProvider, + GRPCServer: grpcSrv, } // Create the server svr, err := server.New(&rootArgs.server, deps) diff --git a/gen/go/authorizer/authz/v1/authz_service.pb.go b/gen/go/authorizer/authz/v1/authz_service.pb.go new file mode 100644 index 00000000..4a1d0f5e --- /dev/null +++ b/gen/go/authorizer/authz/v1/authz_service.pb.go @@ -0,0 +1,262 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: authorizer/authz/v1/authz_service.proto + +package authzv1 + +import ( + _ "github.com/authorizerdev/authorizer/gen/go/authorizer/common/v1" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 ListMyPermissionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListMyPermissionsRequest) Reset() { + *x = ListMyPermissionsRequest{} + mi := &file_authorizer_authz_v1_authz_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListMyPermissionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMyPermissionsRequest) ProtoMessage() {} + +func (x *ListMyPermissionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_authz_v1_authz_service_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 ListMyPermissionsRequest.ProtoReflect.Descriptor instead. +func (*ListMyPermissionsRequest) Descriptor() ([]byte, []int) { + return file_authorizer_authz_v1_authz_service_proto_rawDescGZIP(), []int{0} +} + +type ListMyPermissionsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Permissions []*Permission `protobuf:"bytes,1,rep,name=permissions,proto3" json:"permissions,omitempty"` +} + +func (x *ListMyPermissionsResponse) Reset() { + *x = ListMyPermissionsResponse{} + mi := &file_authorizer_authz_v1_authz_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListMyPermissionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMyPermissionsResponse) ProtoMessage() {} + +func (x *ListMyPermissionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_authz_v1_authz_service_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 ListMyPermissionsResponse.ProtoReflect.Descriptor instead. +func (*ListMyPermissionsResponse) Descriptor() ([]byte, []int) { + return file_authorizer_authz_v1_authz_service_proto_rawDescGZIP(), []int{1} +} + +func (x *ListMyPermissionsResponse) GetPermissions() []*Permission { + if x != nil { + return x.Permissions + } + return nil +} + +type Permission struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + Scope string `protobuf:"bytes,2,opt,name=scope,proto3" json:"scope,omitempty"` +} + +func (x *Permission) Reset() { + *x = Permission{} + mi := &file_authorizer_authz_v1_authz_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Permission) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Permission) ProtoMessage() {} + +func (x *Permission) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_authz_v1_authz_service_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 Permission.ProtoReflect.Descriptor instead. +func (*Permission) Descriptor() ([]byte, []int) { + return file_authorizer_authz_v1_authz_service_proto_rawDescGZIP(), []int{2} +} + +func (x *Permission) GetResource() string { + if x != nil { + return x.Resource + } + return "" +} + +func (x *Permission) GetScope() string { + if x != nil { + return x.Scope + } + return "" +} + +var File_authorizer_authz_v1_authz_service_proto protoreflect.FileDescriptor + +var file_authorizer_authz_v1_authz_service_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x61, 0x75, 0x74, + 0x68, 0x7a, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x5f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 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, 0x74, 0x6f, 0x1a, 0x26, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, + 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1a, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x79, 0x50, 0x65, + 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x5e, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x79, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, + 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, + 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x22, 0x3e, 0x0a, 0x0a, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, + 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x32, 0xab, 0x01, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x9a, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x79, 0x50, 0x65, 0x72, 0x6d, + 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x4d, 0x79, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x4d, 0x79, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x92, 0xb5, 0x18, 0x02, 0x08, 0x01, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, + 0x6d, 0x65, 0x2f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0xe2, + 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x72, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x42, 0x11, 0x41, 0x75, 0x74, 0x68, + 0x7a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x64, 0x65, 0x76, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2f, 0x76, 0x31, 0x3b, + 0x61, 0x75, 0x74, 0x68, 0x7a, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x41, 0x58, 0xaa, 0x02, 0x13, + 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x7a, + 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x41, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x41, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x3a, 0x3a, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x3a, + 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_authorizer_authz_v1_authz_service_proto_rawDescOnce sync.Once + file_authorizer_authz_v1_authz_service_proto_rawDescData = file_authorizer_authz_v1_authz_service_proto_rawDesc +) + +func file_authorizer_authz_v1_authz_service_proto_rawDescGZIP() []byte { + file_authorizer_authz_v1_authz_service_proto_rawDescOnce.Do(func() { + file_authorizer_authz_v1_authz_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authorizer_authz_v1_authz_service_proto_rawDescData) + }) + return file_authorizer_authz_v1_authz_service_proto_rawDescData +} + +var file_authorizer_authz_v1_authz_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_authorizer_authz_v1_authz_service_proto_goTypes = []any{ + (*ListMyPermissionsRequest)(nil), // 0: authorizer.authz.v1.ListMyPermissionsRequest + (*ListMyPermissionsResponse)(nil), // 1: authorizer.authz.v1.ListMyPermissionsResponse + (*Permission)(nil), // 2: authorizer.authz.v1.Permission +} +var file_authorizer_authz_v1_authz_service_proto_depIdxs = []int32{ + 2, // 0: authorizer.authz.v1.ListMyPermissionsResponse.permissions:type_name -> authorizer.authz.v1.Permission + 0, // 1: authorizer.authz.v1.AuthzService.ListMyPermissions:input_type -> authorizer.authz.v1.ListMyPermissionsRequest + 1, // 2: authorizer.authz.v1.AuthzService.ListMyPermissions:output_type -> authorizer.authz.v1.ListMyPermissionsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] 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_authorizer_authz_v1_authz_service_proto_init() } +func file_authorizer_authz_v1_authz_service_proto_init() { + if File_authorizer_authz_v1_authz_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_authorizer_authz_v1_authz_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_authorizer_authz_v1_authz_service_proto_goTypes, + DependencyIndexes: file_authorizer_authz_v1_authz_service_proto_depIdxs, + MessageInfos: file_authorizer_authz_v1_authz_service_proto_msgTypes, + }.Build() + File_authorizer_authz_v1_authz_service_proto = out.File + file_authorizer_authz_v1_authz_service_proto_rawDesc = nil + file_authorizer_authz_v1_authz_service_proto_goTypes = nil + file_authorizer_authz_v1_authz_service_proto_depIdxs = nil +} diff --git a/gen/go/authorizer/authz/v1/authz_service.pb.gw.go b/gen/go/authorizer/authz/v1/authz_service.pb.gw.go new file mode 100644 index 00000000..b64ba7b3 --- /dev/null +++ b/gen/go/authorizer/authz/v1/authz_service.pb.gw.go @@ -0,0 +1,156 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: authorizer/authz/v1/authz_service.proto + +/* +Package authzv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package authzv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_AuthzService_ListMyPermissions_0(ctx context.Context, marshaler runtime.Marshaler, client AuthzServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListMyPermissionsRequest + var metadata runtime.ServerMetadata + + msg, err := client.ListMyPermissions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_AuthzService_ListMyPermissions_0(ctx context.Context, marshaler runtime.Marshaler, server AuthzServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListMyPermissionsRequest + var metadata runtime.ServerMetadata + + msg, err := server.ListMyPermissions(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterAuthzServiceHandlerServer registers the http handlers for service AuthzService to "mux". +// UnaryRPC :call AuthzServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAuthzServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterAuthzServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthzServiceServer) error { + + mux.Handle("GET", pattern_AuthzService_ListMyPermissions_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, "/authorizer.authz.v1.AuthzService/ListMyPermissions", runtime.WithHTTPPathPattern("/v1/users/me/permissions")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_AuthzService_ListMyPermissions_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_AuthzService_ListMyPermissions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterAuthzServiceHandlerFromEndpoint is same as RegisterAuthzServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterAuthzServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterAuthzServiceHandler(ctx, mux, conn) +} + +// RegisterAuthzServiceHandler registers the http handlers for service AuthzService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterAuthzServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterAuthzServiceHandlerClient(ctx, mux, NewAuthzServiceClient(conn)) +} + +// RegisterAuthzServiceHandlerClient registers the http handlers for service AuthzService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthzServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthzServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "AuthzServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterAuthzServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthzServiceClient) error { + + mux.Handle("GET", pattern_AuthzService_ListMyPermissions_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, "/authorizer.authz.v1.AuthzService/ListMyPermissions", runtime.WithHTTPPathPattern("/v1/users/me/permissions")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_AuthzService_ListMyPermissions_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_AuthzService_ListMyPermissions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_AuthzService_ListMyPermissions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "users", "me", "permissions"}, "")) +) + +var ( + forward_AuthzService_ListMyPermissions_0 = runtime.ForwardResponseMessage +) diff --git a/gen/go/authorizer/authz/v1/authz_service_grpc.pb.go b/gen/go/authorizer/authz/v1/authz_service_grpc.pb.go new file mode 100644 index 00000000..d22e08fe --- /dev/null +++ b/gen/go/authorizer/authz/v1/authz_service_grpc.pb.go @@ -0,0 +1,131 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: authorizer/authz/v1/authz_service.proto + +package authzv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + AuthzService_ListMyPermissions_FullMethodName = "/authorizer.authz.v1.AuthzService/ListMyPermissions" +) + +// AuthzServiceClient is the client API for AuthzService service. +// +// 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. +// +// AuthzService is the user-facing fine-grained-authorization surface. The +// admin CRUD on resources/scopes/policies/permissions remains GraphQL-only +// (dashboard consumer). +type AuthzServiceClient interface { + // ListMyPermissions returns every (resource, scope) pair the caller is + // allowed to act on, derived from their roles and the policy engine. + ListMyPermissions(ctx context.Context, in *ListMyPermissionsRequest, opts ...grpc.CallOption) (*ListMyPermissionsResponse, error) +} + +type authzServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAuthzServiceClient(cc grpc.ClientConnInterface) AuthzServiceClient { + return &authzServiceClient{cc} +} + +func (c *authzServiceClient) ListMyPermissions(ctx context.Context, in *ListMyPermissionsRequest, opts ...grpc.CallOption) (*ListMyPermissionsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListMyPermissionsResponse) + err := c.cc.Invoke(ctx, AuthzService_ListMyPermissions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AuthzServiceServer is the server API for AuthzService service. +// All implementations should embed UnimplementedAuthzServiceServer +// for forward compatibility. +// +// AuthzService is the user-facing fine-grained-authorization surface. The +// admin CRUD on resources/scopes/policies/permissions remains GraphQL-only +// (dashboard consumer). +type AuthzServiceServer interface { + // ListMyPermissions returns every (resource, scope) pair the caller is + // allowed to act on, derived from their roles and the policy engine. + ListMyPermissions(context.Context, *ListMyPermissionsRequest) (*ListMyPermissionsResponse, error) +} + +// UnimplementedAuthzServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedAuthzServiceServer struct{} + +func (UnimplementedAuthzServiceServer) ListMyPermissions(context.Context, *ListMyPermissionsRequest) (*ListMyPermissionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListMyPermissions not implemented") +} +func (UnimplementedAuthzServiceServer) testEmbeddedByValue() {} + +// UnsafeAuthzServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AuthzServiceServer will +// result in compilation errors. +type UnsafeAuthzServiceServer interface { + mustEmbedUnimplementedAuthzServiceServer() +} + +func RegisterAuthzServiceServer(s grpc.ServiceRegistrar, srv AuthzServiceServer) { + // If the following call pancis, it indicates UnimplementedAuthzServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&AuthzService_ServiceDesc, srv) +} + +func _AuthzService_ListMyPermissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListMyPermissionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthzServiceServer).ListMyPermissions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthzService_ListMyPermissions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthzServiceServer).ListMyPermissions(ctx, req.(*ListMyPermissionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AuthzService_ServiceDesc is the grpc.ServiceDesc for AuthzService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AuthzService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "authorizer.authz.v1.AuthzService", + HandlerType: (*AuthzServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListMyPermissions", + Handler: _AuthzService_ListMyPermissions_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "authorizer/authz/v1/authz_service.proto", +} diff --git a/gen/go/authorizer/meta/v1/meta_service.pb.go b/gen/go/authorizer/meta/v1/meta_service.pb.go new file mode 100644 index 00000000..a5a9e4c3 --- /dev/null +++ b/gen/go/authorizer/meta/v1/meta_service.pb.go @@ -0,0 +1,421 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: authorizer/meta/v1/meta_service.proto + +package metav1 + +import ( + _ "github.com/authorizerdev/authorizer/gen/go/authorizer/common/v1" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 GetMetaRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetMetaRequest) Reset() { + *x = GetMetaRequest{} + mi := &file_authorizer_meta_v1_meta_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMetaRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMetaRequest) ProtoMessage() {} + +func (x *GetMetaRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_meta_v1_meta_service_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 GetMetaRequest.ProtoReflect.Descriptor instead. +func (*GetMetaRequest) Descriptor() ([]byte, []int) { + return file_authorizer_meta_v1_meta_service_proto_rawDescGZIP(), []int{0} +} + +// GetMetaResponse mirrors the GraphQL Meta type 1:1. Field naming uses the +// existing snake_case names so existing consumers see the same shape over +// REST. +type GetMetaResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + IsGoogleLoginEnabled bool `protobuf:"varint,3,opt,name=is_google_login_enabled,json=isGoogleLoginEnabled,proto3" json:"is_google_login_enabled,omitempty"` + IsFacebookLoginEnabled bool `protobuf:"varint,4,opt,name=is_facebook_login_enabled,json=isFacebookLoginEnabled,proto3" json:"is_facebook_login_enabled,omitempty"` + IsGithubLoginEnabled bool `protobuf:"varint,5,opt,name=is_github_login_enabled,json=isGithubLoginEnabled,proto3" json:"is_github_login_enabled,omitempty"` + IsLinkedinLoginEnabled bool `protobuf:"varint,6,opt,name=is_linkedin_login_enabled,json=isLinkedinLoginEnabled,proto3" json:"is_linkedin_login_enabled,omitempty"` + IsAppleLoginEnabled bool `protobuf:"varint,7,opt,name=is_apple_login_enabled,json=isAppleLoginEnabled,proto3" json:"is_apple_login_enabled,omitempty"` + IsDiscordLoginEnabled bool `protobuf:"varint,8,opt,name=is_discord_login_enabled,json=isDiscordLoginEnabled,proto3" json:"is_discord_login_enabled,omitempty"` + IsTwitterLoginEnabled bool `protobuf:"varint,9,opt,name=is_twitter_login_enabled,json=isTwitterLoginEnabled,proto3" json:"is_twitter_login_enabled,omitempty"` + IsMicrosoftLoginEnabled bool `protobuf:"varint,10,opt,name=is_microsoft_login_enabled,json=isMicrosoftLoginEnabled,proto3" json:"is_microsoft_login_enabled,omitempty"` + IsTwitchLoginEnabled bool `protobuf:"varint,11,opt,name=is_twitch_login_enabled,json=isTwitchLoginEnabled,proto3" json:"is_twitch_login_enabled,omitempty"` + IsRobloxLoginEnabled bool `protobuf:"varint,12,opt,name=is_roblox_login_enabled,json=isRobloxLoginEnabled,proto3" json:"is_roblox_login_enabled,omitempty"` + IsEmailVerificationEnabled bool `protobuf:"varint,13,opt,name=is_email_verification_enabled,json=isEmailVerificationEnabled,proto3" json:"is_email_verification_enabled,omitempty"` + IsBasicAuthenticationEnabled bool `protobuf:"varint,14,opt,name=is_basic_authentication_enabled,json=isBasicAuthenticationEnabled,proto3" json:"is_basic_authentication_enabled,omitempty"` + IsMagicLinkLoginEnabled bool `protobuf:"varint,15,opt,name=is_magic_link_login_enabled,json=isMagicLinkLoginEnabled,proto3" json:"is_magic_link_login_enabled,omitempty"` + IsSignUpEnabled bool `protobuf:"varint,16,opt,name=is_sign_up_enabled,json=isSignUpEnabled,proto3" json:"is_sign_up_enabled,omitempty"` + IsStrongPasswordEnabled bool `protobuf:"varint,17,opt,name=is_strong_password_enabled,json=isStrongPasswordEnabled,proto3" json:"is_strong_password_enabled,omitempty"` + IsMultiFactorAuthEnabled bool `protobuf:"varint,18,opt,name=is_multi_factor_auth_enabled,json=isMultiFactorAuthEnabled,proto3" json:"is_multi_factor_auth_enabled,omitempty"` + IsMobileBasicAuthenticationEnabled bool `protobuf:"varint,19,opt,name=is_mobile_basic_authentication_enabled,json=isMobileBasicAuthenticationEnabled,proto3" json:"is_mobile_basic_authentication_enabled,omitempty"` + IsPhoneVerificationEnabled bool `protobuf:"varint,20,opt,name=is_phone_verification_enabled,json=isPhoneVerificationEnabled,proto3" json:"is_phone_verification_enabled,omitempty"` +} + +func (x *GetMetaResponse) Reset() { + *x = GetMetaResponse{} + mi := &file_authorizer_meta_v1_meta_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMetaResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMetaResponse) ProtoMessage() {} + +func (x *GetMetaResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_meta_v1_meta_service_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 GetMetaResponse.ProtoReflect.Descriptor instead. +func (*GetMetaResponse) Descriptor() ([]byte, []int) { + return file_authorizer_meta_v1_meta_service_proto_rawDescGZIP(), []int{1} +} + +func (x *GetMetaResponse) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *GetMetaResponse) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *GetMetaResponse) GetIsGoogleLoginEnabled() bool { + if x != nil { + return x.IsGoogleLoginEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsFacebookLoginEnabled() bool { + if x != nil { + return x.IsFacebookLoginEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsGithubLoginEnabled() bool { + if x != nil { + return x.IsGithubLoginEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsLinkedinLoginEnabled() bool { + if x != nil { + return x.IsLinkedinLoginEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsAppleLoginEnabled() bool { + if x != nil { + return x.IsAppleLoginEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsDiscordLoginEnabled() bool { + if x != nil { + return x.IsDiscordLoginEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsTwitterLoginEnabled() bool { + if x != nil { + return x.IsTwitterLoginEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsMicrosoftLoginEnabled() bool { + if x != nil { + return x.IsMicrosoftLoginEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsTwitchLoginEnabled() bool { + if x != nil { + return x.IsTwitchLoginEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsRobloxLoginEnabled() bool { + if x != nil { + return x.IsRobloxLoginEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsEmailVerificationEnabled() bool { + if x != nil { + return x.IsEmailVerificationEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsBasicAuthenticationEnabled() bool { + if x != nil { + return x.IsBasicAuthenticationEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsMagicLinkLoginEnabled() bool { + if x != nil { + return x.IsMagicLinkLoginEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsSignUpEnabled() bool { + if x != nil { + return x.IsSignUpEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsStrongPasswordEnabled() bool { + if x != nil { + return x.IsStrongPasswordEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsMultiFactorAuthEnabled() bool { + if x != nil { + return x.IsMultiFactorAuthEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsMobileBasicAuthenticationEnabled() bool { + if x != nil { + return x.IsMobileBasicAuthenticationEnabled + } + return false +} + +func (x *GetMetaResponse) GetIsPhoneVerificationEnabled() bool { + if x != nil { + return x.IsPhoneVerificationEnabled + } + return false +} + +var File_authorizer_meta_v1_meta_service_proto protoreflect.FileDescriptor + +var file_authorizer_meta_v1_meta_service_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x6d, 0x65, 0x74, + 0x61, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x76, 0x31, 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, 0x74, 0x6f, 0x1a, 0x26, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x10, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x87, 0x09, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x35, + 0x0a, 0x17, 0x69, 0x73, 0x5f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x69, + 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x14, 0x69, 0x73, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x39, 0x0a, 0x19, 0x69, 0x73, 0x5f, 0x66, 0x61, 0x63, 0x65, + 0x62, 0x6f, 0x6f, 0x6b, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x69, 0x73, 0x46, 0x61, 0x63, 0x65, + 0x62, 0x6f, 0x6f, 0x6b, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x12, 0x35, 0x0a, 0x17, 0x69, 0x73, 0x5f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x5f, 0x6c, 0x6f, + 0x67, 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x14, 0x69, 0x73, 0x47, 0x69, 0x74, 0x68, 0x75, 0x62, 0x4c, 0x6f, 0x67, 0x69, 0x6e, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x39, 0x0a, 0x19, 0x69, 0x73, 0x5f, 0x6c, 0x69, + 0x6e, 0x6b, 0x65, 0x64, 0x69, 0x6e, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x69, 0x73, 0x4c, 0x69, + 0x6e, 0x6b, 0x65, 0x64, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x12, 0x33, 0x0a, 0x16, 0x69, 0x73, 0x5f, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x5f, 0x6c, + 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x13, 0x69, 0x73, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x18, 0x69, 0x73, 0x5f, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x69, 0x73, 0x44, 0x69, 0x73, + 0x63, 0x6f, 0x72, 0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x12, 0x37, 0x0a, 0x18, 0x69, 0x73, 0x5f, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x6c, + 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x15, 0x69, 0x73, 0x54, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x4c, 0x6f, 0x67, + 0x69, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x1a, 0x69, 0x73, 0x5f, + 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, + 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x69, + 0x73, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x17, 0x69, 0x73, 0x5f, 0x74, 0x77, 0x69, + 0x74, 0x63, 0x68, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x69, 0x73, 0x54, 0x77, 0x69, 0x74, 0x63, + 0x68, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x35, 0x0a, + 0x17, 0x69, 0x73, 0x5f, 0x72, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, + 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, + 0x69, 0x73, 0x52, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x45, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x12, 0x41, 0x0a, 0x1d, 0x69, 0x73, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, + 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1a, 0x69, 0x73, 0x45, + 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x45, 0x0a, 0x1f, 0x69, 0x73, 0x5f, 0x62, 0x61, + 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x1c, 0x69, 0x73, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x3c, + 0x0a, 0x1b, 0x69, 0x73, 0x5f, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, + 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0f, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x17, 0x69, 0x73, 0x4d, 0x61, 0x67, 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, + 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x12, + 0x69, 0x73, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x5f, 0x75, 0x70, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69, 0x73, 0x53, 0x69, 0x67, 0x6e, + 0x55, 0x70, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x1a, 0x69, 0x73, 0x5f, + 0x73, 0x74, 0x72, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, + 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x69, + 0x73, 0x53, 0x74, 0x72, 0x6f, 0x6e, 0x67, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x3e, 0x0a, 0x1c, 0x69, 0x73, 0x5f, 0x6d, 0x75, 0x6c, + 0x74, 0x69, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x69, 0x73, + 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x41, 0x75, 0x74, 0x68, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x52, 0x0a, 0x26, 0x69, 0x73, 0x5f, 0x6d, 0x6f, 0x62, + 0x69, 0x6c, 0x65, 0x5f, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, + 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x22, 0x69, 0x73, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65, + 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x41, 0x0a, 0x1d, 0x69, 0x73, + 0x5f, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x1a, 0x69, 0x73, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x32, 0x7d, 0x0a, + 0x0b, 0x4d, 0x65, 0x74, 0x61, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6e, 0x0a, 0x07, + 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x22, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x1a, 0x92, 0xb5, 0x18, 0x02, 0x08, 0x01, 0xa0, 0xb5, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x0a, 0x12, 0x08, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x42, 0xda, 0x01, 0x0a, + 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, + 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x4d, 0x65, 0x74, 0x61, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x44, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x72, 0x64, 0x65, 0x76, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x72, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x65, 0x74, 0x61, 0x76, + 0x31, 0xa2, 0x02, 0x03, 0x41, 0x4d, 0x58, 0xaa, 0x02, 0x12, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x4d, 0x65, 0x74, 0x61, 0x5c, 0x56, + 0x31, 0xe2, 0x02, 0x1e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x4d, + 0x65, 0x74, 0x61, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x14, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x3a, + 0x3a, 0x4d, 0x65, 0x74, 0x61, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_authorizer_meta_v1_meta_service_proto_rawDescOnce sync.Once + file_authorizer_meta_v1_meta_service_proto_rawDescData = file_authorizer_meta_v1_meta_service_proto_rawDesc +) + +func file_authorizer_meta_v1_meta_service_proto_rawDescGZIP() []byte { + file_authorizer_meta_v1_meta_service_proto_rawDescOnce.Do(func() { + file_authorizer_meta_v1_meta_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authorizer_meta_v1_meta_service_proto_rawDescData) + }) + return file_authorizer_meta_v1_meta_service_proto_rawDescData +} + +var file_authorizer_meta_v1_meta_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_authorizer_meta_v1_meta_service_proto_goTypes = []any{ + (*GetMetaRequest)(nil), // 0: authorizer.meta.v1.GetMetaRequest + (*GetMetaResponse)(nil), // 1: authorizer.meta.v1.GetMetaResponse +} +var file_authorizer_meta_v1_meta_service_proto_depIdxs = []int32{ + 0, // 0: authorizer.meta.v1.MetaService.GetMeta:input_type -> authorizer.meta.v1.GetMetaRequest + 1, // 1: authorizer.meta.v1.MetaService.GetMeta:output_type -> authorizer.meta.v1.GetMetaResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_authorizer_meta_v1_meta_service_proto_init() } +func file_authorizer_meta_v1_meta_service_proto_init() { + if File_authorizer_meta_v1_meta_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_authorizer_meta_v1_meta_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_authorizer_meta_v1_meta_service_proto_goTypes, + DependencyIndexes: file_authorizer_meta_v1_meta_service_proto_depIdxs, + MessageInfos: file_authorizer_meta_v1_meta_service_proto_msgTypes, + }.Build() + File_authorizer_meta_v1_meta_service_proto = out.File + file_authorizer_meta_v1_meta_service_proto_rawDesc = nil + file_authorizer_meta_v1_meta_service_proto_goTypes = nil + file_authorizer_meta_v1_meta_service_proto_depIdxs = nil +} diff --git a/gen/go/authorizer/meta/v1/meta_service.pb.gw.go b/gen/go/authorizer/meta/v1/meta_service.pb.gw.go new file mode 100644 index 00000000..a03e76a0 --- /dev/null +++ b/gen/go/authorizer/meta/v1/meta_service.pb.gw.go @@ -0,0 +1,156 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: authorizer/meta/v1/meta_service.proto + +/* +Package metav1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package metav1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_MetaService_GetMeta_0(ctx context.Context, marshaler runtime.Marshaler, client MetaServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetMetaRequest + var metadata runtime.ServerMetadata + + msg, err := client.GetMeta(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_MetaService_GetMeta_0(ctx context.Context, marshaler runtime.Marshaler, server MetaServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetMetaRequest + var metadata runtime.ServerMetadata + + msg, err := server.GetMeta(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterMetaServiceHandlerServer registers the http handlers for service MetaService to "mux". +// UnaryRPC :call MetaServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMetaServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterMetaServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MetaServiceServer) error { + + mux.Handle("GET", pattern_MetaService_GetMeta_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, "/authorizer.meta.v1.MetaService/GetMeta", runtime.WithHTTPPathPattern("/v1/meta")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_MetaService_GetMeta_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_MetaService_GetMeta_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterMetaServiceHandlerFromEndpoint is same as RegisterMetaServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMetaServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterMetaServiceHandler(ctx, mux, conn) +} + +// RegisterMetaServiceHandler registers the http handlers for service MetaService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMetaServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMetaServiceHandlerClient(ctx, mux, NewMetaServiceClient(conn)) +} + +// RegisterMetaServiceHandlerClient registers the http handlers for service MetaService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MetaServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MetaServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MetaServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterMetaServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MetaServiceClient) error { + + mux.Handle("GET", pattern_MetaService_GetMeta_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, "/authorizer.meta.v1.MetaService/GetMeta", runtime.WithHTTPPathPattern("/v1/meta")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_MetaService_GetMeta_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MetaService_GetMeta_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_MetaService_GetMeta_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "meta"}, "")) +) + +var ( + forward_MetaService_GetMeta_0 = runtime.ForwardResponseMessage +) diff --git a/gen/go/authorizer/meta/v1/meta_service_grpc.pb.go b/gen/go/authorizer/meta/v1/meta_service_grpc.pb.go new file mode 100644 index 00000000..8caef485 --- /dev/null +++ b/gen/go/authorizer/meta/v1/meta_service_grpc.pb.go @@ -0,0 +1,127 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: authorizer/meta/v1/meta_service.proto + +package metav1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + MetaService_GetMeta_FullMethodName = "/authorizer.meta.v1.MetaService/GetMeta" +) + +// MetaServiceClient is the client API for MetaService service. +// +// 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. +// +// MetaService exposes server-discovery information. All methods are public. +type MetaServiceClient interface { + // GetMeta returns the server's feature-flag and provider configuration. + // Used by SPAs to decide which login UIs to render. + GetMeta(ctx context.Context, in *GetMetaRequest, opts ...grpc.CallOption) (*GetMetaResponse, error) +} + +type metaServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewMetaServiceClient(cc grpc.ClientConnInterface) MetaServiceClient { + return &metaServiceClient{cc} +} + +func (c *metaServiceClient) GetMeta(ctx context.Context, in *GetMetaRequest, opts ...grpc.CallOption) (*GetMetaResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetMetaResponse) + err := c.cc.Invoke(ctx, MetaService_GetMeta_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MetaServiceServer is the server API for MetaService service. +// All implementations should embed UnimplementedMetaServiceServer +// for forward compatibility. +// +// MetaService exposes server-discovery information. All methods are public. +type MetaServiceServer interface { + // GetMeta returns the server's feature-flag and provider configuration. + // Used by SPAs to decide which login UIs to render. + GetMeta(context.Context, *GetMetaRequest) (*GetMetaResponse, error) +} + +// UnimplementedMetaServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedMetaServiceServer struct{} + +func (UnimplementedMetaServiceServer) GetMeta(context.Context, *GetMetaRequest) (*GetMetaResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMeta not implemented") +} +func (UnimplementedMetaServiceServer) testEmbeddedByValue() {} + +// UnsafeMetaServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MetaServiceServer will +// result in compilation errors. +type UnsafeMetaServiceServer interface { + mustEmbedUnimplementedMetaServiceServer() +} + +func RegisterMetaServiceServer(s grpc.ServiceRegistrar, srv MetaServiceServer) { + // If the following call pancis, it indicates UnimplementedMetaServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&MetaService_ServiceDesc, srv) +} + +func _MetaService_GetMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMetaRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MetaServiceServer).GetMeta(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MetaService_GetMeta_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MetaServiceServer).GetMeta(ctx, req.(*GetMetaRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// MetaService_ServiceDesc is the grpc.ServiceDesc for MetaService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var MetaService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "authorizer.meta.v1.MetaService", + HandlerType: (*MetaServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetMeta", + Handler: _MetaService_GetMeta_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "authorizer/meta/v1/meta_service.proto", +} diff --git a/gen/go/authorizer/session/v1/magic_link_service.pb.go b/gen/go/authorizer/session/v1/magic_link_service.pb.go new file mode 100644 index 00000000..433976b8 --- /dev/null +++ b/gen/go/authorizer/session/v1/magic_link_service.pb.go @@ -0,0 +1,254 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: authorizer/session/v1/magic_link_service.proto + +package sessionv1 + +import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + _ "github.com/authorizerdev/authorizer/gen/go/authorizer/common/v1" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 CreateMagicLinkRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` + Scope []string `protobuf:"bytes,3,rep,name=scope,proto3" json:"scope,omitempty"` + State string `protobuf:"bytes,4,opt,name=state,proto3" json:"state,omitempty"` + RedirectUri string `protobuf:"bytes,5,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"` +} + +func (x *CreateMagicLinkRequest) Reset() { + *x = CreateMagicLinkRequest{} + mi := &file_authorizer_session_v1_magic_link_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateMagicLinkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMagicLinkRequest) ProtoMessage() {} + +func (x *CreateMagicLinkRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_magic_link_service_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 CreateMagicLinkRequest.ProtoReflect.Descriptor instead. +func (*CreateMagicLinkRequest) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_magic_link_service_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateMagicLinkRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *CreateMagicLinkRequest) GetRoles() []string { + if x != nil { + return x.Roles + } + return nil +} + +func (x *CreateMagicLinkRequest) GetScope() []string { + if x != nil { + return x.Scope + } + return nil +} + +func (x *CreateMagicLinkRequest) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *CreateMagicLinkRequest) GetRedirectUri() string { + if x != nil { + return x.RedirectUri + } + return "" +} + +type CreateMagicLinkResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *CreateMagicLinkResponse) Reset() { + *x = CreateMagicLinkResponse{} + mi := &file_authorizer_session_v1_magic_link_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateMagicLinkResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMagicLinkResponse) ProtoMessage() {} + +func (x *CreateMagicLinkResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_magic_link_service_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 CreateMagicLinkResponse.ProtoReflect.Descriptor instead. +func (*CreateMagicLinkResponse) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_magic_link_service_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateMagicLinkResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +var File_authorizer_session_v1_magic_link_service_proto protoreflect.FileDescriptor + +var file_authorizer_session_v1_magic_link_service_proto_rawDesc = []byte{ + 0x0a, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6c, 0x69, + 0x6e, 0x6b, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x15, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, + 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, + 0x74, 0x6f, 0x1a, 0x26, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9f, 0x01, 0x0a, 0x16, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x67, 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x18, 0xc0, 0x02, 0x60, 0x01, + 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x64, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x55, 0x72, 0x69, 0x22, 0x33, 0x0a, 0x17, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x67, 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x32, 0xa9, 0x01, 0x0a, 0x10, 0x4d, 0x61, 0x67, 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x94, 0x01, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4d, 0x61, 0x67, 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x2d, 0x2e, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x67, 0x69, 0x63, 0x4c, 0x69, + 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x67, 0x69, 0x63, 0x4c, 0x69, 0x6e, + 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x98, 0xb5, 0x18, 0x01, 0xa0, + 0xb5, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, + 0x31, 0x2f, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x2d, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x42, 0xf4, 0x01, + 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x15, 0x4d, 0x61, 0x67, + 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x64, 0x65, 0x76, 0x2f, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, + 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x76, 0x31, + 0xa2, 0x02, 0x03, 0x41, 0x53, 0x58, 0xaa, 0x02, 0x15, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, + 0x15, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x21, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x41, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x3a, 0x3a, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_authorizer_session_v1_magic_link_service_proto_rawDescOnce sync.Once + file_authorizer_session_v1_magic_link_service_proto_rawDescData = file_authorizer_session_v1_magic_link_service_proto_rawDesc +) + +func file_authorizer_session_v1_magic_link_service_proto_rawDescGZIP() []byte { + file_authorizer_session_v1_magic_link_service_proto_rawDescOnce.Do(func() { + file_authorizer_session_v1_magic_link_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authorizer_session_v1_magic_link_service_proto_rawDescData) + }) + return file_authorizer_session_v1_magic_link_service_proto_rawDescData +} + +var file_authorizer_session_v1_magic_link_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_authorizer_session_v1_magic_link_service_proto_goTypes = []any{ + (*CreateMagicLinkRequest)(nil), // 0: authorizer.session.v1.CreateMagicLinkRequest + (*CreateMagicLinkResponse)(nil), // 1: authorizer.session.v1.CreateMagicLinkResponse +} +var file_authorizer_session_v1_magic_link_service_proto_depIdxs = []int32{ + 0, // 0: authorizer.session.v1.MagicLinkService.CreateMagicLink:input_type -> authorizer.session.v1.CreateMagicLinkRequest + 1, // 1: authorizer.session.v1.MagicLinkService.CreateMagicLink:output_type -> authorizer.session.v1.CreateMagicLinkResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_authorizer_session_v1_magic_link_service_proto_init() } +func file_authorizer_session_v1_magic_link_service_proto_init() { + if File_authorizer_session_v1_magic_link_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_authorizer_session_v1_magic_link_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_authorizer_session_v1_magic_link_service_proto_goTypes, + DependencyIndexes: file_authorizer_session_v1_magic_link_service_proto_depIdxs, + MessageInfos: file_authorizer_session_v1_magic_link_service_proto_msgTypes, + }.Build() + File_authorizer_session_v1_magic_link_service_proto = out.File + file_authorizer_session_v1_magic_link_service_proto_rawDesc = nil + file_authorizer_session_v1_magic_link_service_proto_goTypes = nil + file_authorizer_session_v1_magic_link_service_proto_depIdxs = nil +} diff --git a/gen/go/authorizer/session/v1/magic_link_service.pb.gw.go b/gen/go/authorizer/session/v1/magic_link_service.pb.gw.go new file mode 100644 index 00000000..79c3c642 --- /dev/null +++ b/gen/go/authorizer/session/v1/magic_link_service.pb.gw.go @@ -0,0 +1,164 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: authorizer/session/v1/magic_link_service.proto + +/* +Package sessionv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package sessionv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_MagicLinkService_CreateMagicLink_0(ctx context.Context, marshaler runtime.Marshaler, client MagicLinkServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateMagicLinkRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateMagicLink(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_MagicLinkService_CreateMagicLink_0(ctx context.Context, marshaler runtime.Marshaler, server MagicLinkServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateMagicLinkRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateMagicLink(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterMagicLinkServiceHandlerServer registers the http handlers for service MagicLinkService to "mux". +// UnaryRPC :call MagicLinkServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMagicLinkServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterMagicLinkServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MagicLinkServiceServer) error { + + mux.Handle("POST", pattern_MagicLinkService_CreateMagicLink_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, "/authorizer.session.v1.MagicLinkService/CreateMagicLink", runtime.WithHTTPPathPattern("/v1/magic-links")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_MagicLinkService_CreateMagicLink_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_MagicLinkService_CreateMagicLink_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterMagicLinkServiceHandlerFromEndpoint is same as RegisterMagicLinkServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMagicLinkServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterMagicLinkServiceHandler(ctx, mux, conn) +} + +// RegisterMagicLinkServiceHandler registers the http handlers for service MagicLinkService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMagicLinkServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMagicLinkServiceHandlerClient(ctx, mux, NewMagicLinkServiceClient(conn)) +} + +// RegisterMagicLinkServiceHandlerClient registers the http handlers for service MagicLinkService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MagicLinkServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MagicLinkServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MagicLinkServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterMagicLinkServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MagicLinkServiceClient) error { + + mux.Handle("POST", pattern_MagicLinkService_CreateMagicLink_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, "/authorizer.session.v1.MagicLinkService/CreateMagicLink", runtime.WithHTTPPathPattern("/v1/magic-links")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_MagicLinkService_CreateMagicLink_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MagicLinkService_CreateMagicLink_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_MagicLinkService_CreateMagicLink_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "magic-links"}, "")) +) + +var ( + forward_MagicLinkService_CreateMagicLink_0 = runtime.ForwardResponseMessage +) diff --git a/gen/go/authorizer/session/v1/magic_link_service_grpc.pb.go b/gen/go/authorizer/session/v1/magic_link_service_grpc.pb.go new file mode 100644 index 00000000..90facf6a --- /dev/null +++ b/gen/go/authorizer/session/v1/magic_link_service_grpc.pb.go @@ -0,0 +1,133 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: authorizer/session/v1/magic_link_service.proto + +package sessionv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + MagicLinkService_CreateMagicLink_FullMethodName = "/authorizer.session.v1.MagicLinkService/CreateMagicLink" +) + +// MagicLinkServiceClient is the client API for MagicLinkService service. +// +// 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. +// +// MagicLinkService models passwordless email-link login as the "magic link" +// resource. CreateMagicLink dispatches an email; the user clicks the link +// (handled by the existing /verify_email browser route), which results in a +// new Session via CreateSession with grant.magic_link. +type MagicLinkServiceClient interface { + // CreateMagicLink dispatches a magic-link email. Returns 202: the email + // is sent asynchronously; the link itself drives session creation later. + CreateMagicLink(ctx context.Context, in *CreateMagicLinkRequest, opts ...grpc.CallOption) (*CreateMagicLinkResponse, error) +} + +type magicLinkServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewMagicLinkServiceClient(cc grpc.ClientConnInterface) MagicLinkServiceClient { + return &magicLinkServiceClient{cc} +} + +func (c *magicLinkServiceClient) CreateMagicLink(ctx context.Context, in *CreateMagicLinkRequest, opts ...grpc.CallOption) (*CreateMagicLinkResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateMagicLinkResponse) + err := c.cc.Invoke(ctx, MagicLinkService_CreateMagicLink_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MagicLinkServiceServer is the server API for MagicLinkService service. +// All implementations should embed UnimplementedMagicLinkServiceServer +// for forward compatibility. +// +// MagicLinkService models passwordless email-link login as the "magic link" +// resource. CreateMagicLink dispatches an email; the user clicks the link +// (handled by the existing /verify_email browser route), which results in a +// new Session via CreateSession with grant.magic_link. +type MagicLinkServiceServer interface { + // CreateMagicLink dispatches a magic-link email. Returns 202: the email + // is sent asynchronously; the link itself drives session creation later. + CreateMagicLink(context.Context, *CreateMagicLinkRequest) (*CreateMagicLinkResponse, error) +} + +// UnimplementedMagicLinkServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedMagicLinkServiceServer struct{} + +func (UnimplementedMagicLinkServiceServer) CreateMagicLink(context.Context, *CreateMagicLinkRequest) (*CreateMagicLinkResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateMagicLink not implemented") +} +func (UnimplementedMagicLinkServiceServer) testEmbeddedByValue() {} + +// UnsafeMagicLinkServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MagicLinkServiceServer will +// result in compilation errors. +type UnsafeMagicLinkServiceServer interface { + mustEmbedUnimplementedMagicLinkServiceServer() +} + +func RegisterMagicLinkServiceServer(s grpc.ServiceRegistrar, srv MagicLinkServiceServer) { + // If the following call pancis, it indicates UnimplementedMagicLinkServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&MagicLinkService_ServiceDesc, srv) +} + +func _MagicLinkService_CreateMagicLink_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateMagicLinkRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MagicLinkServiceServer).CreateMagicLink(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MagicLinkService_CreateMagicLink_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MagicLinkServiceServer).CreateMagicLink(ctx, req.(*CreateMagicLinkRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// MagicLinkService_ServiceDesc is the grpc.ServiceDesc for MagicLinkService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var MagicLinkService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "authorizer.session.v1.MagicLinkService", + HandlerType: (*MagicLinkServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateMagicLink", + Handler: _MagicLinkService_CreateMagicLink_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "authorizer/session/v1/magic_link_service.proto", +} diff --git a/gen/go/authorizer/session/v1/session.pb.go b/gen/go/authorizer/session/v1/session.pb.go new file mode 100644 index 00000000..8b73e9db --- /dev/null +++ b/gen/go/authorizer/session/v1/session.pb.go @@ -0,0 +1,335 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: authorizer/session/v1/session.proto + +package sessionv1 + +import ( + v1 "github.com/authorizerdev/authorizer/gen/go/authorizer/user/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// Session is what CreateSession returns: tokens plus enough user context to +// avoid a follow-up GetUser. Mirrors the GraphQL AuthResponse type 1:1 in +// field naming. +type Session struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + ShouldShowEmailOtpScreen bool `protobuf:"varint,2,opt,name=should_show_email_otp_screen,json=shouldShowEmailOtpScreen,proto3" json:"should_show_email_otp_screen,omitempty"` + ShouldShowMobileOtpScreen bool `protobuf:"varint,3,opt,name=should_show_mobile_otp_screen,json=shouldShowMobileOtpScreen,proto3" json:"should_show_mobile_otp_screen,omitempty"` + ShouldShowTotpScreen bool `protobuf:"varint,4,opt,name=should_show_totp_screen,json=shouldShowTotpScreen,proto3" json:"should_show_totp_screen,omitempty"` + AccessToken string `protobuf:"bytes,5,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + IdToken string `protobuf:"bytes,6,opt,name=id_token,json=idToken,proto3" json:"id_token,omitempty"` + RefreshToken string `protobuf:"bytes,7,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` + ExpiresIn int64 `protobuf:"varint,8,opt,name=expires_in,json=expiresIn,proto3" json:"expires_in,omitempty"` + User *v1.User `protobuf:"bytes,9,opt,name=user,proto3" json:"user,omitempty"` + // TOTP enrolment artifacts (set only when CreateSession initiates TOTP setup). + AuthenticatorScannerImage string `protobuf:"bytes,10,opt,name=authenticator_scanner_image,json=authenticatorScannerImage,proto3" json:"authenticator_scanner_image,omitempty"` + AuthenticatorSecret string `protobuf:"bytes,11,opt,name=authenticator_secret,json=authenticatorSecret,proto3" json:"authenticator_secret,omitempty"` + AuthenticatorRecoveryCodes []string `protobuf:"bytes,12,rep,name=authenticator_recovery_codes,json=authenticatorRecoveryCodes,proto3" json:"authenticator_recovery_codes,omitempty"` +} + +func (x *Session) Reset() { + *x = Session{} + mi := &file_authorizer_session_v1_session_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Session) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Session) ProtoMessage() {} + +func (x *Session) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_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 Session.ProtoReflect.Descriptor instead. +func (*Session) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_proto_rawDescGZIP(), []int{0} +} + +func (x *Session) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *Session) GetShouldShowEmailOtpScreen() bool { + if x != nil { + return x.ShouldShowEmailOtpScreen + } + return false +} + +func (x *Session) GetShouldShowMobileOtpScreen() bool { + if x != nil { + return x.ShouldShowMobileOtpScreen + } + return false +} + +func (x *Session) GetShouldShowTotpScreen() bool { + if x != nil { + return x.ShouldShowTotpScreen + } + return false +} + +func (x *Session) GetAccessToken() string { + if x != nil { + return x.AccessToken + } + return "" +} + +func (x *Session) GetIdToken() string { + if x != nil { + return x.IdToken + } + return "" +} + +func (x *Session) GetRefreshToken() string { + if x != nil { + return x.RefreshToken + } + return "" +} + +func (x *Session) GetExpiresIn() int64 { + if x != nil { + return x.ExpiresIn + } + return 0 +} + +func (x *Session) GetUser() *v1.User { + if x != nil { + return x.User + } + return nil +} + +func (x *Session) GetAuthenticatorScannerImage() string { + if x != nil { + return x.AuthenticatorScannerImage + } + return "" +} + +func (x *Session) GetAuthenticatorSecret() string { + if x != nil { + return x.AuthenticatorSecret + } + return "" +} + +func (x *Session) GetAuthenticatorRecoveryCodes() []string { + if x != nil { + return x.AuthenticatorRecoveryCodes + } + return nil +} + +// SessionValidationResult is what CreateSessionValidation returns. +type SessionValidationResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsValid bool `protobuf:"varint,1,opt,name=is_valid,json=isValid,proto3" json:"is_valid,omitempty"` + User *v1.User `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *SessionValidationResult) Reset() { + *x = SessionValidationResult{} + mi := &file_authorizer_session_v1_session_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionValidationResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionValidationResult) ProtoMessage() {} + +func (x *SessionValidationResult) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_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 SessionValidationResult.ProtoReflect.Descriptor instead. +func (*SessionValidationResult) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_proto_rawDescGZIP(), []int{1} +} + +func (x *SessionValidationResult) GetIsValid() bool { + if x != nil { + return x.IsValid + } + return false +} + +func (x *SessionValidationResult) GetUser() *v1.User { + if x != nil { + return x.User + } + return nil +} + +var File_authorizer_session_v1_session_proto protoreflect.FileDescriptor + +var file_authorizer_session_v1_session_proto_rawDesc = []byte{ + 0x0a, 0x23, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1d, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, + 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc1, 0x04, 0x0a, 0x07, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x3e, 0x0a, 0x1c, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x5f, 0x73, 0x68, 0x6f, 0x77, + 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x6f, 0x74, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x65, 0x65, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x53, + 0x68, 0x6f, 0x77, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x4f, 0x74, 0x70, 0x53, 0x63, 0x72, 0x65, 0x65, + 0x6e, 0x12, 0x40, 0x0a, 0x1d, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x5f, 0x73, 0x68, 0x6f, 0x77, + 0x5f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x5f, 0x6f, 0x74, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x65, + 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x19, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, + 0x53, 0x68, 0x6f, 0x77, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x4f, 0x74, 0x70, 0x53, 0x63, 0x72, + 0x65, 0x65, 0x6e, 0x12, 0x35, 0x0a, 0x17, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x5f, 0x73, 0x68, + 0x6f, 0x77, 0x5f, 0x74, 0x6f, 0x74, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x77, + 0x54, 0x6f, 0x74, 0x70, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x19, 0x0a, + 0x08, 0x69, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x69, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x66, 0x72, + 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1d, 0x0a, + 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, 0x69, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x49, 0x6e, 0x12, 0x2c, 0x0a, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x1b, 0x61, 0x75, + 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x73, 0x63, 0x61, 0x6e, + 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x19, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x63, + 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x31, 0x0a, 0x14, 0x61, 0x75, + 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x73, 0x65, 0x63, 0x72, + 0x65, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, + 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x40, 0x0a, + 0x1c, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x72, + 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0c, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x1a, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x6f, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x22, + 0x62, 0x0a, 0x17, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, + 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, + 0x73, 0x65, 0x72, 0x42, 0xeb, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x42, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x64, 0x65, 0x76, 0x2f, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, + 0x41, 0x53, 0x58, 0xaa, 0x02, 0x15, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x15, 0x41, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x21, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x3a, 0x3a, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_authorizer_session_v1_session_proto_rawDescOnce sync.Once + file_authorizer_session_v1_session_proto_rawDescData = file_authorizer_session_v1_session_proto_rawDesc +) + +func file_authorizer_session_v1_session_proto_rawDescGZIP() []byte { + file_authorizer_session_v1_session_proto_rawDescOnce.Do(func() { + file_authorizer_session_v1_session_proto_rawDescData = protoimpl.X.CompressGZIP(file_authorizer_session_v1_session_proto_rawDescData) + }) + return file_authorizer_session_v1_session_proto_rawDescData +} + +var file_authorizer_session_v1_session_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_authorizer_session_v1_session_proto_goTypes = []any{ + (*Session)(nil), // 0: authorizer.session.v1.Session + (*SessionValidationResult)(nil), // 1: authorizer.session.v1.SessionValidationResult + (*v1.User)(nil), // 2: authorizer.user.v1.User +} +var file_authorizer_session_v1_session_proto_depIdxs = []int32{ + 2, // 0: authorizer.session.v1.Session.user:type_name -> authorizer.user.v1.User + 2, // 1: authorizer.session.v1.SessionValidationResult.user:type_name -> authorizer.user.v1.User + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_authorizer_session_v1_session_proto_init() } +func file_authorizer_session_v1_session_proto_init() { + if File_authorizer_session_v1_session_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_authorizer_session_v1_session_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_authorizer_session_v1_session_proto_goTypes, + DependencyIndexes: file_authorizer_session_v1_session_proto_depIdxs, + MessageInfos: file_authorizer_session_v1_session_proto_msgTypes, + }.Build() + File_authorizer_session_v1_session_proto = out.File + file_authorizer_session_v1_session_proto_rawDesc = nil + file_authorizer_session_v1_session_proto_goTypes = nil + file_authorizer_session_v1_session_proto_depIdxs = nil +} diff --git a/gen/go/authorizer/session/v1/session_service.pb.go b/gen/go/authorizer/session/v1/session_service.pb.go new file mode 100644 index 00000000..9de7e6b0 --- /dev/null +++ b/gen/go/authorizer/session/v1/session_service.pb.go @@ -0,0 +1,1029 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: authorizer/session/v1/session_service.proto + +package sessionv1 + +import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + _ "github.com/authorizerdev/authorizer/gen/go/authorizer/common/v1" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 CreateSessionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Grant: + // + // *CreateSessionRequest_Password + // *CreateSessionRequest_Otp + // *CreateSessionRequest_MagicLink + // *CreateSessionRequest_RefreshToken + Grant isCreateSessionRequest_Grant `protobuf_oneof:"grant"` + Roles []string `protobuf:"bytes,10,rep,name=roles,proto3" json:"roles,omitempty"` + Scope []string `protobuf:"bytes,11,rep,name=scope,proto3" json:"scope,omitempty"` + // OAuth2 authorization-code flow state echoed back via c_hash. + State string `protobuf:"bytes,12,opt,name=state,proto3" json:"state,omitempty"` +} + +func (x *CreateSessionRequest) Reset() { + *x = CreateSessionRequest{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSessionRequest) ProtoMessage() {} + +func (x *CreateSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_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 CreateSessionRequest.ProtoReflect.Descriptor instead. +func (*CreateSessionRequest) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{0} +} + +func (m *CreateSessionRequest) GetGrant() isCreateSessionRequest_Grant { + if m != nil { + return m.Grant + } + return nil +} + +func (x *CreateSessionRequest) GetPassword() *PasswordGrant { + if x, ok := x.GetGrant().(*CreateSessionRequest_Password); ok { + return x.Password + } + return nil +} + +func (x *CreateSessionRequest) GetOtp() *OtpGrant { + if x, ok := x.GetGrant().(*CreateSessionRequest_Otp); ok { + return x.Otp + } + return nil +} + +func (x *CreateSessionRequest) GetMagicLink() *MagicLinkGrant { + if x, ok := x.GetGrant().(*CreateSessionRequest_MagicLink); ok { + return x.MagicLink + } + return nil +} + +func (x *CreateSessionRequest) GetRefreshToken() *RefreshTokenGrant { + if x, ok := x.GetGrant().(*CreateSessionRequest_RefreshToken); ok { + return x.RefreshToken + } + return nil +} + +func (x *CreateSessionRequest) GetRoles() []string { + if x != nil { + return x.Roles + } + return nil +} + +func (x *CreateSessionRequest) GetScope() []string { + if x != nil { + return x.Scope + } + return nil +} + +func (x *CreateSessionRequest) GetState() string { + if x != nil { + return x.State + } + return "" +} + +type isCreateSessionRequest_Grant interface { + isCreateSessionRequest_Grant() +} + +type CreateSessionRequest_Password struct { + Password *PasswordGrant `protobuf:"bytes,1,opt,name=password,proto3,oneof"` +} + +type CreateSessionRequest_Otp struct { + Otp *OtpGrant `protobuf:"bytes,2,opt,name=otp,proto3,oneof"` +} + +type CreateSessionRequest_MagicLink struct { + MagicLink *MagicLinkGrant `protobuf:"bytes,3,opt,name=magic_link,json=magicLink,proto3,oneof"` +} + +type CreateSessionRequest_RefreshToken struct { + RefreshToken *RefreshTokenGrant `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3,oneof"` +} + +func (*CreateSessionRequest_Password) isCreateSessionRequest_Grant() {} + +func (*CreateSessionRequest_Otp) isCreateSessionRequest_Grant() {} + +func (*CreateSessionRequest_MagicLink) isCreateSessionRequest_Grant() {} + +func (*CreateSessionRequest_RefreshToken) isCreateSessionRequest_Grant() {} + +type PasswordGrant struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Exactly one of email / phone_number is required. + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + PhoneNumber string `protobuf:"bytes,2,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` + Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *PasswordGrant) Reset() { + *x = PasswordGrant{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PasswordGrant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PasswordGrant) ProtoMessage() {} + +func (x *PasswordGrant) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_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 PasswordGrant.ProtoReflect.Descriptor instead. +func (*PasswordGrant) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{1} +} + +func (x *PasswordGrant) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *PasswordGrant) GetPhoneNumber() string { + if x != nil { + return x.PhoneNumber + } + return "" +} + +func (x *PasswordGrant) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type OtpGrant struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + PhoneNumber string `protobuf:"bytes,2,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` + Otp string `protobuf:"bytes,3,opt,name=otp,proto3" json:"otp,omitempty"` + IsTotp bool `protobuf:"varint,4,opt,name=is_totp,json=isTotp,proto3" json:"is_totp,omitempty"` +} + +func (x *OtpGrant) Reset() { + *x = OtpGrant{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OtpGrant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OtpGrant) ProtoMessage() {} + +func (x *OtpGrant) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_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 OtpGrant.ProtoReflect.Descriptor instead. +func (*OtpGrant) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{2} +} + +func (x *OtpGrant) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *OtpGrant) GetPhoneNumber() string { + if x != nil { + return x.PhoneNumber + } + return "" +} + +func (x *OtpGrant) GetOtp() string { + if x != nil { + return x.Otp + } + return "" +} + +func (x *OtpGrant) GetIsTotp() bool { + if x != nil { + return x.IsTotp + } + return false +} + +type MagicLinkGrant struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The token from the magic-link email URL. + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *MagicLinkGrant) Reset() { + *x = MagicLinkGrant{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MagicLinkGrant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MagicLinkGrant) ProtoMessage() {} + +func (x *MagicLinkGrant) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_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 MagicLinkGrant.ProtoReflect.Descriptor instead. +func (*MagicLinkGrant) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{3} +} + +func (x *MagicLinkGrant) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type RefreshTokenGrant struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RefreshToken string `protobuf:"bytes,1,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` +} + +func (x *RefreshTokenGrant) Reset() { + *x = RefreshTokenGrant{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RefreshTokenGrant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RefreshTokenGrant) ProtoMessage() {} + +func (x *RefreshTokenGrant) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_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 RefreshTokenGrant.ProtoReflect.Descriptor instead. +func (*RefreshTokenGrant) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{4} +} + +func (x *RefreshTokenGrant) GetRefreshToken() string { + if x != nil { + return x.RefreshToken + } + return "" +} + +type GetCurrentSessionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Optional permission filter: deny the request unless the caller holds + // every (resource, scope) pair listed. Matches GraphQL + // SessionQueryRequest.required_permissions. + RequiredPermissions []*PermissionRef `protobuf:"bytes,1,rep,name=required_permissions,json=requiredPermissions,proto3" json:"required_permissions,omitempty"` + Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` + Scope []string `protobuf:"bytes,3,rep,name=scope,proto3" json:"scope,omitempty"` + State string `protobuf:"bytes,4,opt,name=state,proto3" json:"state,omitempty"` +} + +func (x *GetCurrentSessionRequest) Reset() { + *x = GetCurrentSessionRequest{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCurrentSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCurrentSessionRequest) ProtoMessage() {} + +func (x *GetCurrentSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_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 GetCurrentSessionRequest.ProtoReflect.Descriptor instead. +func (*GetCurrentSessionRequest) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{5} +} + +func (x *GetCurrentSessionRequest) GetRequiredPermissions() []*PermissionRef { + if x != nil { + return x.RequiredPermissions + } + return nil +} + +func (x *GetCurrentSessionRequest) GetRoles() []string { + if x != nil { + return x.Roles + } + return nil +} + +func (x *GetCurrentSessionRequest) GetScope() []string { + if x != nil { + return x.Scope + } + return nil +} + +func (x *GetCurrentSessionRequest) GetState() string { + if x != nil { + return x.State + } + return "" +} + +type PermissionRef struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + Scope string `protobuf:"bytes,2,opt,name=scope,proto3" json:"scope,omitempty"` +} + +func (x *PermissionRef) Reset() { + *x = PermissionRef{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PermissionRef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PermissionRef) ProtoMessage() {} + +func (x *PermissionRef) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[6] + 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 PermissionRef.ProtoReflect.Descriptor instead. +func (*PermissionRef) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{6} +} + +func (x *PermissionRef) GetResource() string { + if x != nil { + return x.Resource + } + return "" +} + +func (x *PermissionRef) GetScope() string { + if x != nil { + return x.Scope + } + return "" +} + +type CreateSessionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Session *Session `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"` +} + +func (x *CreateSessionResponse) Reset() { + *x = CreateSessionResponse{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSessionResponse) ProtoMessage() {} + +func (x *CreateSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[7] + 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 CreateSessionResponse.ProtoReflect.Descriptor instead. +func (*CreateSessionResponse) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{7} +} + +func (x *CreateSessionResponse) GetSession() *Session { + if x != nil { + return x.Session + } + return nil +} + +type GetCurrentSessionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Session *Session `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"` +} + +func (x *GetCurrentSessionResponse) Reset() { + *x = GetCurrentSessionResponse{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCurrentSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCurrentSessionResponse) ProtoMessage() {} + +func (x *GetCurrentSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[8] + 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 GetCurrentSessionResponse.ProtoReflect.Descriptor instead. +func (*GetCurrentSessionResponse) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{8} +} + +func (x *GetCurrentSessionResponse) GetSession() *Session { + if x != nil { + return x.Session + } + return nil +} + +type DeleteSessionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteSessionRequest) Reset() { + *x = DeleteSessionRequest{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSessionRequest) ProtoMessage() {} + +func (x *DeleteSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[9] + 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 DeleteSessionRequest.ProtoReflect.Descriptor instead. +func (*DeleteSessionRequest) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{9} +} + +type DeleteSessionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteSessionResponse) Reset() { + *x = DeleteSessionResponse{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSessionResponse) ProtoMessage() {} + +func (x *DeleteSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[10] + 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 DeleteSessionResponse.ProtoReflect.Descriptor instead. +func (*DeleteSessionResponse) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{10} +} + +type CreateSessionValidationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Cookie value (typically the fingerprint hash) to validate. + Cookie string `protobuf:"bytes,1,opt,name=cookie,proto3" json:"cookie,omitempty"` + Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` + RequiredPermissions []*PermissionRef `protobuf:"bytes,3,rep,name=required_permissions,json=requiredPermissions,proto3" json:"required_permissions,omitempty"` +} + +func (x *CreateSessionValidationRequest) Reset() { + *x = CreateSessionValidationRequest{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSessionValidationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSessionValidationRequest) ProtoMessage() {} + +func (x *CreateSessionValidationRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[11] + 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 CreateSessionValidationRequest.ProtoReflect.Descriptor instead. +func (*CreateSessionValidationRequest) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{11} +} + +func (x *CreateSessionValidationRequest) GetCookie() string { + if x != nil { + return x.Cookie + } + return "" +} + +func (x *CreateSessionValidationRequest) GetRoles() []string { + if x != nil { + return x.Roles + } + return nil +} + +func (x *CreateSessionValidationRequest) GetRequiredPermissions() []*PermissionRef { + if x != nil { + return x.RequiredPermissions + } + return nil +} + +type CreateSessionValidationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Result *SessionValidationResult `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` +} + +func (x *CreateSessionValidationResponse) Reset() { + *x = CreateSessionValidationResponse{} + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSessionValidationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSessionValidationResponse) ProtoMessage() {} + +func (x *CreateSessionValidationResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_session_v1_session_service_proto_msgTypes[12] + 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 CreateSessionValidationResponse.ProtoReflect.Descriptor instead. +func (*CreateSessionValidationResponse) Descriptor() ([]byte, []int) { + return file_authorizer_session_v1_session_service_proto_rawDescGZIP(), []int{12} +} + +func (x *CreateSessionValidationResponse) GetResult() *SessionValidationResult { + if x != nil { + return x.Result + } + return nil +} + +var File_authorizer_session_v1_session_service_proto protoreflect.FileDescriptor + +var file_authorizer_session_v1_session_service_proto_rawDesc = []byte{ + 0x0a, 0x2b, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 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, 0x74, 0x6f, 0x1a, + 0x26, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf3, 0x02, 0x0a, + 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x48, 0x00, 0x52, + 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x33, 0x0a, 0x03, 0x6f, 0x74, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4f, + 0x74, 0x70, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x03, 0x6f, 0x74, 0x70, 0x12, 0x46, + 0x0a, 0x0a, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x67, 0x69, 0x63, + 0x4c, 0x69, 0x6e, 0x6b, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x09, 0x6d, 0x61, 0x67, + 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x4f, 0x0a, 0x0d, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, + 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, + 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, + 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x67, 0x72, 0x61, + 0x6e, 0x74, 0x22, 0x83, 0x01, 0x0a, 0x0d, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x47, + 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0x18, 0xc0, 0x02, 0x52, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x2a, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, + 0x02, 0x18, 0x20, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x12, 0x26, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0x80, 0x01, 0x52, 0x08, + 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x8c, 0x01, 0x0a, 0x08, 0x4f, 0x74, 0x70, + 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0x18, 0xc0, 0x02, 0x52, 0x05, + 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x2a, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, + 0x72, 0x02, 0x18, 0x20, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x12, 0x1b, 0x0a, 0x03, 0x6f, 0x74, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, + 0xba, 0x48, 0x06, 0x72, 0x04, 0x10, 0x01, 0x18, 0x10, 0x52, 0x03, 0x6f, 0x74, 0x70, 0x12, 0x17, + 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x74, 0x6f, 0x74, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x06, 0x69, 0x73, 0x54, 0x6f, 0x74, 0x70, 0x22, 0x2f, 0x0a, 0x0e, 0x4d, 0x61, 0x67, 0x69, 0x63, + 0x4c, 0x69, 0x6e, 0x6b, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x05, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x41, 0x0a, 0x11, 0x52, 0x65, 0x66, 0x72, + 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x2c, 0x0a, + 0x0d, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x72, + 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xb5, 0x01, 0x0a, 0x18, + 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x57, 0x0a, 0x14, 0x72, 0x65, 0x71, 0x75, + 0x69, 0x72, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, + 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x52, 0x13, 0x72, 0x65, + 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x22, 0x53, 0x0a, 0x0d, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x66, 0x12, 0x23, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, + 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x05, 0x73, 0x63, 0x6f, + 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x22, 0x51, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x55, 0x0a, 0x19, 0x47, + 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x22, 0x16, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x17, 0x0a, 0x15, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0xb0, 0x01, 0x0a, 0x1e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x06, 0x63, 0x6f, 0x6f, 0x6b, 0x69, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, + 0x06, 0x63, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x57, 0x0a, + 0x14, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x66, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x50, 0x65, 0x72, 0x6d, 0x69, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x69, 0x0a, 0x1f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x06, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x32, 0xf8, 0x04, 0x0a, 0x0e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x8f, 0x01, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x23, 0x92, 0xb5, 0x18, 0x00, 0x98, 0xb5, 0x18, 0x01, 0xa0, 0xb5, 0x18, 0x01, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x01, 0x2a, 0x22, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x95, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x75, + 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x2e, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x1d, 0x92, 0xb5, 0x18, 0x02, 0x08, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, + 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x6d, 0x65, 0x12, 0x87, + 0x01, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x2b, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x98, 0xb5, 0x18, + 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x2a, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x6d, 0x65, 0x12, 0xb1, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x27, 0xa0, 0xb5, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x3a, + 0x01, 0x2a, 0x22, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0xf2, 0x01, 0x0a, + 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x13, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x64, 0x65, 0x76, 0x2f, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, + 0x41, 0x53, 0x58, 0xaa, 0x02, 0x15, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x15, 0x41, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x21, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x3a, 0x3a, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_authorizer_session_v1_session_service_proto_rawDescOnce sync.Once + file_authorizer_session_v1_session_service_proto_rawDescData = file_authorizer_session_v1_session_service_proto_rawDesc +) + +func file_authorizer_session_v1_session_service_proto_rawDescGZIP() []byte { + file_authorizer_session_v1_session_service_proto_rawDescOnce.Do(func() { + file_authorizer_session_v1_session_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authorizer_session_v1_session_service_proto_rawDescData) + }) + return file_authorizer_session_v1_session_service_proto_rawDescData +} + +var file_authorizer_session_v1_session_service_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_authorizer_session_v1_session_service_proto_goTypes = []any{ + (*CreateSessionRequest)(nil), // 0: authorizer.session.v1.CreateSessionRequest + (*PasswordGrant)(nil), // 1: authorizer.session.v1.PasswordGrant + (*OtpGrant)(nil), // 2: authorizer.session.v1.OtpGrant + (*MagicLinkGrant)(nil), // 3: authorizer.session.v1.MagicLinkGrant + (*RefreshTokenGrant)(nil), // 4: authorizer.session.v1.RefreshTokenGrant + (*GetCurrentSessionRequest)(nil), // 5: authorizer.session.v1.GetCurrentSessionRequest + (*PermissionRef)(nil), // 6: authorizer.session.v1.PermissionRef + (*CreateSessionResponse)(nil), // 7: authorizer.session.v1.CreateSessionResponse + (*GetCurrentSessionResponse)(nil), // 8: authorizer.session.v1.GetCurrentSessionResponse + (*DeleteSessionRequest)(nil), // 9: authorizer.session.v1.DeleteSessionRequest + (*DeleteSessionResponse)(nil), // 10: authorizer.session.v1.DeleteSessionResponse + (*CreateSessionValidationRequest)(nil), // 11: authorizer.session.v1.CreateSessionValidationRequest + (*CreateSessionValidationResponse)(nil), // 12: authorizer.session.v1.CreateSessionValidationResponse + (*Session)(nil), // 13: authorizer.session.v1.Session + (*SessionValidationResult)(nil), // 14: authorizer.session.v1.SessionValidationResult +} +var file_authorizer_session_v1_session_service_proto_depIdxs = []int32{ + 1, // 0: authorizer.session.v1.CreateSessionRequest.password:type_name -> authorizer.session.v1.PasswordGrant + 2, // 1: authorizer.session.v1.CreateSessionRequest.otp:type_name -> authorizer.session.v1.OtpGrant + 3, // 2: authorizer.session.v1.CreateSessionRequest.magic_link:type_name -> authorizer.session.v1.MagicLinkGrant + 4, // 3: authorizer.session.v1.CreateSessionRequest.refresh_token:type_name -> authorizer.session.v1.RefreshTokenGrant + 6, // 4: authorizer.session.v1.GetCurrentSessionRequest.required_permissions:type_name -> authorizer.session.v1.PermissionRef + 13, // 5: authorizer.session.v1.CreateSessionResponse.session:type_name -> authorizer.session.v1.Session + 13, // 6: authorizer.session.v1.GetCurrentSessionResponse.session:type_name -> authorizer.session.v1.Session + 6, // 7: authorizer.session.v1.CreateSessionValidationRequest.required_permissions:type_name -> authorizer.session.v1.PermissionRef + 14, // 8: authorizer.session.v1.CreateSessionValidationResponse.result:type_name -> authorizer.session.v1.SessionValidationResult + 0, // 9: authorizer.session.v1.SessionService.CreateSession:input_type -> authorizer.session.v1.CreateSessionRequest + 5, // 10: authorizer.session.v1.SessionService.GetCurrentSession:input_type -> authorizer.session.v1.GetCurrentSessionRequest + 9, // 11: authorizer.session.v1.SessionService.DeleteSession:input_type -> authorizer.session.v1.DeleteSessionRequest + 11, // 12: authorizer.session.v1.SessionService.CreateSessionValidation:input_type -> authorizer.session.v1.CreateSessionValidationRequest + 7, // 13: authorizer.session.v1.SessionService.CreateSession:output_type -> authorizer.session.v1.CreateSessionResponse + 8, // 14: authorizer.session.v1.SessionService.GetCurrentSession:output_type -> authorizer.session.v1.GetCurrentSessionResponse + 10, // 15: authorizer.session.v1.SessionService.DeleteSession:output_type -> authorizer.session.v1.DeleteSessionResponse + 12, // 16: authorizer.session.v1.SessionService.CreateSessionValidation:output_type -> authorizer.session.v1.CreateSessionValidationResponse + 13, // [13:17] is the sub-list for method output_type + 9, // [9:13] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_authorizer_session_v1_session_service_proto_init() } +func file_authorizer_session_v1_session_service_proto_init() { + if File_authorizer_session_v1_session_service_proto != nil { + return + } + file_authorizer_session_v1_session_proto_init() + file_authorizer_session_v1_session_service_proto_msgTypes[0].OneofWrappers = []any{ + (*CreateSessionRequest_Password)(nil), + (*CreateSessionRequest_Otp)(nil), + (*CreateSessionRequest_MagicLink)(nil), + (*CreateSessionRequest_RefreshToken)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_authorizer_session_v1_session_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 13, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_authorizer_session_v1_session_service_proto_goTypes, + DependencyIndexes: file_authorizer_session_v1_session_service_proto_depIdxs, + MessageInfos: file_authorizer_session_v1_session_service_proto_msgTypes, + }.Build() + File_authorizer_session_v1_session_service_proto = out.File + file_authorizer_session_v1_session_service_proto_rawDesc = nil + file_authorizer_session_v1_session_service_proto_goTypes = nil + file_authorizer_session_v1_session_service_proto_depIdxs = nil +} diff --git a/gen/go/authorizer/session/v1/session_service.pb.gw.go b/gen/go/authorizer/session/v1/session_service.pb.gw.go new file mode 100644 index 00000000..17684b5b --- /dev/null +++ b/gen/go/authorizer/session/v1/session_service.pb.gw.go @@ -0,0 +1,397 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: authorizer/session/v1/session_service.proto + +/* +Package sessionv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package sessionv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_SessionService_CreateSession_0(ctx context.Context, marshaler runtime.Marshaler, client SessionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateSessionRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateSession(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SessionService_CreateSession_0(ctx context.Context, marshaler runtime.Marshaler, server SessionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateSessionRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateSession(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_SessionService_GetCurrentSession_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_SessionService_GetCurrentSession_0(ctx context.Context, marshaler runtime.Marshaler, client SessionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetCurrentSessionRequest + 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_SessionService_GetCurrentSession_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetCurrentSession(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SessionService_GetCurrentSession_0(ctx context.Context, marshaler runtime.Marshaler, server SessionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetCurrentSessionRequest + 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_SessionService_GetCurrentSession_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetCurrentSession(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SessionService_DeleteSession_0(ctx context.Context, marshaler runtime.Marshaler, client SessionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteSessionRequest + var metadata runtime.ServerMetadata + + msg, err := client.DeleteSession(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SessionService_DeleteSession_0(ctx context.Context, marshaler runtime.Marshaler, server SessionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteSessionRequest + var metadata runtime.ServerMetadata + + msg, err := server.DeleteSession(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SessionService_CreateSessionValidation_0(ctx context.Context, marshaler runtime.Marshaler, client SessionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateSessionValidationRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateSessionValidation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SessionService_CreateSessionValidation_0(ctx context.Context, marshaler runtime.Marshaler, server SessionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateSessionValidationRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateSessionValidation(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterSessionServiceHandlerServer registers the http handlers for service SessionService to "mux". +// UnaryRPC :call SessionServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSessionServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterSessionServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SessionServiceServer) error { + + mux.Handle("POST", pattern_SessionService_CreateSession_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, "/authorizer.session.v1.SessionService/CreateSession", runtime.WithHTTPPathPattern("/v1/sessions")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SessionService_CreateSession_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_SessionService_CreateSession_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SessionService_GetCurrentSession_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, "/authorizer.session.v1.SessionService/GetCurrentSession", runtime.WithHTTPPathPattern("/v1/sessions/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SessionService_GetCurrentSession_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_SessionService_GetCurrentSession_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_SessionService_DeleteSession_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, "/authorizer.session.v1.SessionService/DeleteSession", runtime.WithHTTPPathPattern("/v1/sessions/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SessionService_DeleteSession_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_SessionService_DeleteSession_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SessionService_CreateSessionValidation_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, "/authorizer.session.v1.SessionService/CreateSessionValidation", runtime.WithHTTPPathPattern("/v1/sessions/validations")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SessionService_CreateSessionValidation_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_SessionService_CreateSessionValidation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterSessionServiceHandlerFromEndpoint is same as RegisterSessionServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterSessionServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterSessionServiceHandler(ctx, mux, conn) +} + +// RegisterSessionServiceHandler registers the http handlers for service SessionService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterSessionServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterSessionServiceHandlerClient(ctx, mux, NewSessionServiceClient(conn)) +} + +// RegisterSessionServiceHandlerClient registers the http handlers for service SessionService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SessionServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SessionServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "SessionServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterSessionServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SessionServiceClient) error { + + mux.Handle("POST", pattern_SessionService_CreateSession_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, "/authorizer.session.v1.SessionService/CreateSession", runtime.WithHTTPPathPattern("/v1/sessions")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SessionService_CreateSession_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SessionService_CreateSession_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SessionService_GetCurrentSession_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, "/authorizer.session.v1.SessionService/GetCurrentSession", runtime.WithHTTPPathPattern("/v1/sessions/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SessionService_GetCurrentSession_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SessionService_GetCurrentSession_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_SessionService_DeleteSession_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, "/authorizer.session.v1.SessionService/DeleteSession", runtime.WithHTTPPathPattern("/v1/sessions/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SessionService_DeleteSession_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SessionService_DeleteSession_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SessionService_CreateSessionValidation_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, "/authorizer.session.v1.SessionService/CreateSessionValidation", runtime.WithHTTPPathPattern("/v1/sessions/validations")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SessionService_CreateSessionValidation_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SessionService_CreateSessionValidation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_SessionService_CreateSession_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "sessions"}, "")) + + pattern_SessionService_GetCurrentSession_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "sessions", "me"}, "")) + + pattern_SessionService_DeleteSession_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "sessions", "me"}, "")) + + pattern_SessionService_CreateSessionValidation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "sessions", "validations"}, "")) +) + +var ( + forward_SessionService_CreateSession_0 = runtime.ForwardResponseMessage + + forward_SessionService_GetCurrentSession_0 = runtime.ForwardResponseMessage + + forward_SessionService_DeleteSession_0 = runtime.ForwardResponseMessage + + forward_SessionService_CreateSessionValidation_0 = runtime.ForwardResponseMessage +) diff --git a/gen/go/authorizer/session/v1/session_service_grpc.pb.go b/gen/go/authorizer/session/v1/session_service_grpc.pb.go new file mode 100644 index 00000000..c8d21bfc --- /dev/null +++ b/gen/go/authorizer/session/v1/session_service_grpc.pb.go @@ -0,0 +1,265 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: authorizer/session/v1/session_service.proto + +package sessionv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + SessionService_CreateSession_FullMethodName = "/authorizer.session.v1.SessionService/CreateSession" + SessionService_GetCurrentSession_FullMethodName = "/authorizer.session.v1.SessionService/GetCurrentSession" + SessionService_DeleteSession_FullMethodName = "/authorizer.session.v1.SessionService/DeleteSession" + SessionService_CreateSessionValidation_FullMethodName = "/authorizer.session.v1.SessionService/CreateSessionValidation" +) + +// SessionServiceClient is the client API for SessionService service. +// +// 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. +// +// SessionService manages user sessions. Creating a session is "login"; +// deleting it is "logout"; reading the current session answers "am I +// authenticated, and as whom?". +type SessionServiceClient interface { + // CreateSession authenticates a user and returns a new Session. The + // request carries exactly one credential type via `oneof grant`. Browser + // callers (REST) additionally receive Set-Cookie headers. The OAuth2 + // token endpoint at POST /oauth/token remains the spec-compliant + // alternative for OAuth clients. + CreateSession(ctx context.Context, in *CreateSessionRequest, opts ...grpc.CallOption) (*CreateSessionResponse, error) + // GetCurrentSession returns the session bound to the caller's cookie or + // bearer token. Returns NOT_FOUND when unauthenticated. + GetCurrentSession(ctx context.Context, in *GetCurrentSessionRequest, opts ...grpc.CallOption) (*GetCurrentSessionResponse, error) + // DeleteSession ends the caller's current session. Always returns empty + // on success, even if no session was active (idempotent). + DeleteSession(ctx context.Context, in *DeleteSessionRequest, opts ...grpc.CallOption) (*DeleteSessionResponse, error) + // CreateSessionValidation validates a cookie/token held by a third party + // — the typed equivalent of "is this session real?" used by backend + // services validating tokens forwarded by an upstream proxy. + CreateSessionValidation(ctx context.Context, in *CreateSessionValidationRequest, opts ...grpc.CallOption) (*CreateSessionValidationResponse, error) +} + +type sessionServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSessionServiceClient(cc grpc.ClientConnInterface) SessionServiceClient { + return &sessionServiceClient{cc} +} + +func (c *sessionServiceClient) CreateSession(ctx context.Context, in *CreateSessionRequest, opts ...grpc.CallOption) (*CreateSessionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateSessionResponse) + err := c.cc.Invoke(ctx, SessionService_CreateSession_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sessionServiceClient) GetCurrentSession(ctx context.Context, in *GetCurrentSessionRequest, opts ...grpc.CallOption) (*GetCurrentSessionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetCurrentSessionResponse) + err := c.cc.Invoke(ctx, SessionService_GetCurrentSession_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sessionServiceClient) DeleteSession(ctx context.Context, in *DeleteSessionRequest, opts ...grpc.CallOption) (*DeleteSessionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteSessionResponse) + err := c.cc.Invoke(ctx, SessionService_DeleteSession_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sessionServiceClient) CreateSessionValidation(ctx context.Context, in *CreateSessionValidationRequest, opts ...grpc.CallOption) (*CreateSessionValidationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateSessionValidationResponse) + err := c.cc.Invoke(ctx, SessionService_CreateSessionValidation_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SessionServiceServer is the server API for SessionService service. +// All implementations should embed UnimplementedSessionServiceServer +// for forward compatibility. +// +// SessionService manages user sessions. Creating a session is "login"; +// deleting it is "logout"; reading the current session answers "am I +// authenticated, and as whom?". +type SessionServiceServer interface { + // CreateSession authenticates a user and returns a new Session. The + // request carries exactly one credential type via `oneof grant`. Browser + // callers (REST) additionally receive Set-Cookie headers. The OAuth2 + // token endpoint at POST /oauth/token remains the spec-compliant + // alternative for OAuth clients. + CreateSession(context.Context, *CreateSessionRequest) (*CreateSessionResponse, error) + // GetCurrentSession returns the session bound to the caller's cookie or + // bearer token. Returns NOT_FOUND when unauthenticated. + GetCurrentSession(context.Context, *GetCurrentSessionRequest) (*GetCurrentSessionResponse, error) + // DeleteSession ends the caller's current session. Always returns empty + // on success, even if no session was active (idempotent). + DeleteSession(context.Context, *DeleteSessionRequest) (*DeleteSessionResponse, error) + // CreateSessionValidation validates a cookie/token held by a third party + // — the typed equivalent of "is this session real?" used by backend + // services validating tokens forwarded by an upstream proxy. + CreateSessionValidation(context.Context, *CreateSessionValidationRequest) (*CreateSessionValidationResponse, error) +} + +// UnimplementedSessionServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSessionServiceServer struct{} + +func (UnimplementedSessionServiceServer) CreateSession(context.Context, *CreateSessionRequest) (*CreateSessionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateSession not implemented") +} +func (UnimplementedSessionServiceServer) GetCurrentSession(context.Context, *GetCurrentSessionRequest) (*GetCurrentSessionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCurrentSession not implemented") +} +func (UnimplementedSessionServiceServer) DeleteSession(context.Context, *DeleteSessionRequest) (*DeleteSessionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteSession not implemented") +} +func (UnimplementedSessionServiceServer) CreateSessionValidation(context.Context, *CreateSessionValidationRequest) (*CreateSessionValidationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateSessionValidation not implemented") +} +func (UnimplementedSessionServiceServer) testEmbeddedByValue() {} + +// UnsafeSessionServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SessionServiceServer will +// result in compilation errors. +type UnsafeSessionServiceServer interface { + mustEmbedUnimplementedSessionServiceServer() +} + +func RegisterSessionServiceServer(s grpc.ServiceRegistrar, srv SessionServiceServer) { + // If the following call pancis, it indicates UnimplementedSessionServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&SessionService_ServiceDesc, srv) +} + +func _SessionService_CreateSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateSessionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionServiceServer).CreateSession(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionService_CreateSession_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionServiceServer).CreateSession(ctx, req.(*CreateSessionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SessionService_GetCurrentSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCurrentSessionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionServiceServer).GetCurrentSession(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionService_GetCurrentSession_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionServiceServer).GetCurrentSession(ctx, req.(*GetCurrentSessionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SessionService_DeleteSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteSessionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionServiceServer).DeleteSession(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionService_DeleteSession_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionServiceServer).DeleteSession(ctx, req.(*DeleteSessionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SessionService_CreateSessionValidation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateSessionValidationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionServiceServer).CreateSessionValidation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionService_CreateSessionValidation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionServiceServer).CreateSessionValidation(ctx, req.(*CreateSessionValidationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SessionService_ServiceDesc is the grpc.ServiceDesc for SessionService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SessionService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "authorizer.session.v1.SessionService", + HandlerType: (*SessionServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateSession", + Handler: _SessionService_CreateSession_Handler, + }, + { + MethodName: "GetCurrentSession", + Handler: _SessionService_GetCurrentSession_Handler, + }, + { + MethodName: "DeleteSession", + Handler: _SessionService_DeleteSession_Handler, + }, + { + MethodName: "CreateSessionValidation", + Handler: _SessionService_CreateSessionValidation_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "authorizer/session/v1/session_service.proto", +} diff --git a/gen/go/authorizer/token/v1/token_service.pb.go b/gen/go/authorizer/token/v1/token_service.pb.go new file mode 100644 index 00000000..cfadfe9d --- /dev/null +++ b/gen/go/authorizer/token/v1/token_service.pb.go @@ -0,0 +1,429 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: authorizer/token/v1/token_service.proto + +package tokenv1 + +import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + _ "github.com/authorizerdev/authorizer/gen/go/authorizer/common/v1" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + structpb "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" +) + +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 CreateTokenValidationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // One of: "access_token", "id_token", "refresh_token". + TokenType string `protobuf:"bytes,1,opt,name=token_type,json=tokenType,proto3" json:"token_type,omitempty"` + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + Roles []string `protobuf:"bytes,3,rep,name=roles,proto3" json:"roles,omitempty"` + RequiredPermissions []*PermissionRef `protobuf:"bytes,4,rep,name=required_permissions,json=requiredPermissions,proto3" json:"required_permissions,omitempty"` +} + +func (x *CreateTokenValidationRequest) Reset() { + *x = CreateTokenValidationRequest{} + mi := &file_authorizer_token_v1_token_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateTokenValidationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateTokenValidationRequest) ProtoMessage() {} + +func (x *CreateTokenValidationRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_token_v1_token_service_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 CreateTokenValidationRequest.ProtoReflect.Descriptor instead. +func (*CreateTokenValidationRequest) Descriptor() ([]byte, []int) { + return file_authorizer_token_v1_token_service_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateTokenValidationRequest) GetTokenType() string { + if x != nil { + return x.TokenType + } + return "" +} + +func (x *CreateTokenValidationRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *CreateTokenValidationRequest) GetRoles() []string { + if x != nil { + return x.Roles + } + return nil +} + +func (x *CreateTokenValidationRequest) GetRequiredPermissions() []*PermissionRef { + if x != nil { + return x.RequiredPermissions + } + return nil +} + +type PermissionRef struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + Scope string `protobuf:"bytes,2,opt,name=scope,proto3" json:"scope,omitempty"` +} + +func (x *PermissionRef) Reset() { + *x = PermissionRef{} + mi := &file_authorizer_token_v1_token_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PermissionRef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PermissionRef) ProtoMessage() {} + +func (x *PermissionRef) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_token_v1_token_service_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 PermissionRef.ProtoReflect.Descriptor instead. +func (*PermissionRef) Descriptor() ([]byte, []int) { + return file_authorizer_token_v1_token_service_proto_rawDescGZIP(), []int{1} +} + +func (x *PermissionRef) GetResource() string { + if x != nil { + return x.Resource + } + return "" +} + +func (x *PermissionRef) GetScope() string { + if x != nil { + return x.Scope + } + return "" +} + +type CreateTokenValidationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsValid bool `protobuf:"varint,1,opt,name=is_valid,json=isValid,proto3" json:"is_valid,omitempty"` + // Free-form JWT claims; matches GraphQL ValidateJWTTokenResponse.claims. + Claims *structpb.Struct `protobuf:"bytes,2,opt,name=claims,proto3" json:"claims,omitempty"` +} + +func (x *CreateTokenValidationResponse) Reset() { + *x = CreateTokenValidationResponse{} + mi := &file_authorizer_token_v1_token_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateTokenValidationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateTokenValidationResponse) ProtoMessage() {} + +func (x *CreateTokenValidationResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_token_v1_token_service_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 CreateTokenValidationResponse.ProtoReflect.Descriptor instead. +func (*CreateTokenValidationResponse) Descriptor() ([]byte, []int) { + return file_authorizer_token_v1_token_service_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateTokenValidationResponse) GetIsValid() bool { + if x != nil { + return x.IsValid + } + return false +} + +func (x *CreateTokenValidationResponse) GetClaims() *structpb.Struct { + if x != nil { + return x.Claims + } + return nil +} + +type RevokeRefreshTokenRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RefreshToken string `protobuf:"bytes,1,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` +} + +func (x *RevokeRefreshTokenRequest) Reset() { + *x = RevokeRefreshTokenRequest{} + mi := &file_authorizer_token_v1_token_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RevokeRefreshTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RevokeRefreshTokenRequest) ProtoMessage() {} + +func (x *RevokeRefreshTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_token_v1_token_service_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 RevokeRefreshTokenRequest.ProtoReflect.Descriptor instead. +func (*RevokeRefreshTokenRequest) Descriptor() ([]byte, []int) { + return file_authorizer_token_v1_token_service_proto_rawDescGZIP(), []int{3} +} + +func (x *RevokeRefreshTokenRequest) GetRefreshToken() string { + if x != nil { + return x.RefreshToken + } + return "" +} + +type RevokeRefreshTokenResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RevokeRefreshTokenResponse) Reset() { + *x = RevokeRefreshTokenResponse{} + mi := &file_authorizer_token_v1_token_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RevokeRefreshTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RevokeRefreshTokenResponse) ProtoMessage() {} + +func (x *RevokeRefreshTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_token_v1_token_service_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 RevokeRefreshTokenResponse.ProtoReflect.Descriptor instead. +func (*RevokeRefreshTokenResponse) Descriptor() ([]byte, []int) { + return file_authorizer_token_v1_token_service_proto_rawDescGZIP(), []int{4} +} + +var File_authorizer_token_v1_token_service_proto protoreflect.FileDescriptor + +var file_authorizer_token_v1_token_service_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1b, + 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 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, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xd2, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x56, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x26, 0x0a, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x09, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, + 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x55, 0x0a, + 0x14, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x52, + 0x13, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x53, 0x0a, 0x0d, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x12, 0x23, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, + 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x05, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, + 0x10, 0x01, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x22, 0x6b, 0x0a, 0x1d, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, + 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x06, + 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x22, 0x49, 0x0a, 0x19, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, + 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x0d, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x22, 0x1c, 0x0a, 0x1a, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x52, 0x65, 0x66, 0x72, 0x65, + 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, + 0xdd, 0x02, 0x0a, 0x0c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0xa4, 0x01, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x2e, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x56, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x56, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x24, 0xa0, 0xb5, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x3a, 0x01, 0x2a, + 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2d, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0xa5, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x76, 0x6f, + 0x6b, 0x65, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2e, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x52, 0x65, 0x66, 0x72, 0x65, + 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x52, 0x65, 0x66, 0x72, 0x65, + 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x2e, 0x98, 0xb5, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x2a, 0x22, 0x2f, 0x76, 0x31, + 0x2f, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x2d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x2f, + 0x7b, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x7d, 0x42, + 0xe2, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x72, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x11, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x64, 0x65, 0x76, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, + 0x3b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x54, 0x58, 0xaa, 0x02, + 0x13, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x72, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x41, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_authorizer_token_v1_token_service_proto_rawDescOnce sync.Once + file_authorizer_token_v1_token_service_proto_rawDescData = file_authorizer_token_v1_token_service_proto_rawDesc +) + +func file_authorizer_token_v1_token_service_proto_rawDescGZIP() []byte { + file_authorizer_token_v1_token_service_proto_rawDescOnce.Do(func() { + file_authorizer_token_v1_token_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authorizer_token_v1_token_service_proto_rawDescData) + }) + return file_authorizer_token_v1_token_service_proto_rawDescData +} + +var file_authorizer_token_v1_token_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_authorizer_token_v1_token_service_proto_goTypes = []any{ + (*CreateTokenValidationRequest)(nil), // 0: authorizer.token.v1.CreateTokenValidationRequest + (*PermissionRef)(nil), // 1: authorizer.token.v1.PermissionRef + (*CreateTokenValidationResponse)(nil), // 2: authorizer.token.v1.CreateTokenValidationResponse + (*RevokeRefreshTokenRequest)(nil), // 3: authorizer.token.v1.RevokeRefreshTokenRequest + (*RevokeRefreshTokenResponse)(nil), // 4: authorizer.token.v1.RevokeRefreshTokenResponse + (*structpb.Struct)(nil), // 5: google.protobuf.Struct +} +var file_authorizer_token_v1_token_service_proto_depIdxs = []int32{ + 1, // 0: authorizer.token.v1.CreateTokenValidationRequest.required_permissions:type_name -> authorizer.token.v1.PermissionRef + 5, // 1: authorizer.token.v1.CreateTokenValidationResponse.claims:type_name -> google.protobuf.Struct + 0, // 2: authorizer.token.v1.TokenService.CreateTokenValidation:input_type -> authorizer.token.v1.CreateTokenValidationRequest + 3, // 3: authorizer.token.v1.TokenService.RevokeRefreshToken:input_type -> authorizer.token.v1.RevokeRefreshTokenRequest + 2, // 4: authorizer.token.v1.TokenService.CreateTokenValidation:output_type -> authorizer.token.v1.CreateTokenValidationResponse + 4, // 5: authorizer.token.v1.TokenService.RevokeRefreshToken:output_type -> authorizer.token.v1.RevokeRefreshTokenResponse + 4, // [4:6] is the sub-list for method output_type + 2, // [2:4] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_authorizer_token_v1_token_service_proto_init() } +func file_authorizer_token_v1_token_service_proto_init() { + if File_authorizer_token_v1_token_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_authorizer_token_v1_token_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_authorizer_token_v1_token_service_proto_goTypes, + DependencyIndexes: file_authorizer_token_v1_token_service_proto_depIdxs, + MessageInfos: file_authorizer_token_v1_token_service_proto_msgTypes, + }.Build() + File_authorizer_token_v1_token_service_proto = out.File + file_authorizer_token_v1_token_service_proto_rawDesc = nil + file_authorizer_token_v1_token_service_proto_goTypes = nil + file_authorizer_token_v1_token_service_proto_depIdxs = nil +} diff --git a/gen/go/authorizer/token/v1/token_service.pb.gw.go b/gen/go/authorizer/token/v1/token_service.pb.gw.go new file mode 100644 index 00000000..297c1803 --- /dev/null +++ b/gen/go/authorizer/token/v1/token_service.pb.gw.go @@ -0,0 +1,267 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: authorizer/token/v1/token_service.proto + +/* +Package tokenv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package tokenv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_TokenService_CreateTokenValidation_0(ctx context.Context, marshaler runtime.Marshaler, client TokenServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateTokenValidationRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateTokenValidation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TokenService_CreateTokenValidation_0(ctx context.Context, marshaler runtime.Marshaler, server TokenServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateTokenValidationRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateTokenValidation(ctx, &protoReq) + return msg, metadata, err + +} + +func request_TokenService_RevokeRefreshToken_0(ctx context.Context, marshaler runtime.Marshaler, client TokenServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RevokeRefreshTokenRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["refresh_token"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "refresh_token") + } + + protoReq.RefreshToken, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "refresh_token", err) + } + + msg, err := client.RevokeRefreshToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TokenService_RevokeRefreshToken_0(ctx context.Context, marshaler runtime.Marshaler, server TokenServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RevokeRefreshTokenRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["refresh_token"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "refresh_token") + } + + protoReq.RefreshToken, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "refresh_token", err) + } + + msg, err := server.RevokeRefreshToken(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterTokenServiceHandlerServer registers the http handlers for service TokenService to "mux". +// UnaryRPC :call TokenServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTokenServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterTokenServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TokenServiceServer) error { + + mux.Handle("POST", pattern_TokenService_CreateTokenValidation_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, "/authorizer.token.v1.TokenService/CreateTokenValidation", runtime.WithHTTPPathPattern("/v1/token-validations")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TokenService_CreateTokenValidation_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_TokenService_CreateTokenValidation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_TokenService_RevokeRefreshToken_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, "/authorizer.token.v1.TokenService/RevokeRefreshToken", runtime.WithHTTPPathPattern("/v1/refresh-tokens/{refresh_token}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TokenService_RevokeRefreshToken_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_TokenService_RevokeRefreshToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterTokenServiceHandlerFromEndpoint is same as RegisterTokenServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterTokenServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterTokenServiceHandler(ctx, mux, conn) +} + +// RegisterTokenServiceHandler registers the http handlers for service TokenService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterTokenServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterTokenServiceHandlerClient(ctx, mux, NewTokenServiceClient(conn)) +} + +// RegisterTokenServiceHandlerClient registers the http handlers for service TokenService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TokenServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TokenServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "TokenServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterTokenServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TokenServiceClient) error { + + mux.Handle("POST", pattern_TokenService_CreateTokenValidation_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, "/authorizer.token.v1.TokenService/CreateTokenValidation", runtime.WithHTTPPathPattern("/v1/token-validations")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TokenService_CreateTokenValidation_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_TokenService_CreateTokenValidation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_TokenService_RevokeRefreshToken_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, "/authorizer.token.v1.TokenService/RevokeRefreshToken", runtime.WithHTTPPathPattern("/v1/refresh-tokens/{refresh_token}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TokenService_RevokeRefreshToken_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_TokenService_RevokeRefreshToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_TokenService_CreateTokenValidation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "token-validations"}, "")) + + pattern_TokenService_RevokeRefreshToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "refresh-tokens", "refresh_token"}, "")) +) + +var ( + forward_TokenService_CreateTokenValidation_0 = runtime.ForwardResponseMessage + + forward_TokenService_RevokeRefreshToken_0 = runtime.ForwardResponseMessage +) diff --git a/gen/go/authorizer/token/v1/token_service_grpc.pb.go b/gen/go/authorizer/token/v1/token_service_grpc.pb.go new file mode 100644 index 00000000..68a4dc6f --- /dev/null +++ b/gen/go/authorizer/token/v1/token_service_grpc.pb.go @@ -0,0 +1,177 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: authorizer/token/v1/token_service.proto + +package tokenv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + TokenService_CreateTokenValidation_FullMethodName = "/authorizer.token.v1.TokenService/CreateTokenValidation" + TokenService_RevokeRefreshToken_FullMethodName = "/authorizer.token.v1.TokenService/RevokeRefreshToken" +) + +// TokenServiceClient is the client API for TokenService service. +// +// 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. +// +// TokenService operates on existing tokens — distinct from SessionService +// (which *issues* tokens via login). RFC 7009 token revocation and RFC 7662 +// introspection remain at their standards-mandated /oauth/* HTTP paths for +// OAuth-spec compatibility; this service offers typed mirrors for +// first-party SDK use. +type TokenServiceClient interface { + // CreateTokenValidation validates a JWT and returns its claims. Equivalent + // to GraphQL validate_jwt_token. + CreateTokenValidation(ctx context.Context, in *CreateTokenValidationRequest, opts ...grpc.CallOption) (*CreateTokenValidationResponse, error) + // RevokeRefreshToken invalidates a refresh token. Typed mirror of + // RFC 7009 `POST /oauth/revoke`. + RevokeRefreshToken(ctx context.Context, in *RevokeRefreshTokenRequest, opts ...grpc.CallOption) (*RevokeRefreshTokenResponse, error) +} + +type tokenServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewTokenServiceClient(cc grpc.ClientConnInterface) TokenServiceClient { + return &tokenServiceClient{cc} +} + +func (c *tokenServiceClient) CreateTokenValidation(ctx context.Context, in *CreateTokenValidationRequest, opts ...grpc.CallOption) (*CreateTokenValidationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateTokenValidationResponse) + err := c.cc.Invoke(ctx, TokenService_CreateTokenValidation_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tokenServiceClient) RevokeRefreshToken(ctx context.Context, in *RevokeRefreshTokenRequest, opts ...grpc.CallOption) (*RevokeRefreshTokenResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RevokeRefreshTokenResponse) + err := c.cc.Invoke(ctx, TokenService_RevokeRefreshToken_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TokenServiceServer is the server API for TokenService service. +// All implementations should embed UnimplementedTokenServiceServer +// for forward compatibility. +// +// TokenService operates on existing tokens — distinct from SessionService +// (which *issues* tokens via login). RFC 7009 token revocation and RFC 7662 +// introspection remain at their standards-mandated /oauth/* HTTP paths for +// OAuth-spec compatibility; this service offers typed mirrors for +// first-party SDK use. +type TokenServiceServer interface { + // CreateTokenValidation validates a JWT and returns its claims. Equivalent + // to GraphQL validate_jwt_token. + CreateTokenValidation(context.Context, *CreateTokenValidationRequest) (*CreateTokenValidationResponse, error) + // RevokeRefreshToken invalidates a refresh token. Typed mirror of + // RFC 7009 `POST /oauth/revoke`. + RevokeRefreshToken(context.Context, *RevokeRefreshTokenRequest) (*RevokeRefreshTokenResponse, error) +} + +// UnimplementedTokenServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedTokenServiceServer struct{} + +func (UnimplementedTokenServiceServer) CreateTokenValidation(context.Context, *CreateTokenValidationRequest) (*CreateTokenValidationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateTokenValidation not implemented") +} +func (UnimplementedTokenServiceServer) RevokeRefreshToken(context.Context, *RevokeRefreshTokenRequest) (*RevokeRefreshTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RevokeRefreshToken not implemented") +} +func (UnimplementedTokenServiceServer) testEmbeddedByValue() {} + +// UnsafeTokenServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TokenServiceServer will +// result in compilation errors. +type UnsafeTokenServiceServer interface { + mustEmbedUnimplementedTokenServiceServer() +} + +func RegisterTokenServiceServer(s grpc.ServiceRegistrar, srv TokenServiceServer) { + // If the following call pancis, it indicates UnimplementedTokenServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&TokenService_ServiceDesc, srv) +} + +func _TokenService_CreateTokenValidation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateTokenValidationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TokenServiceServer).CreateTokenValidation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TokenService_CreateTokenValidation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TokenServiceServer).CreateTokenValidation(ctx, req.(*CreateTokenValidationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TokenService_RevokeRefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RevokeRefreshTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TokenServiceServer).RevokeRefreshToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TokenService_RevokeRefreshToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TokenServiceServer).RevokeRefreshToken(ctx, req.(*RevokeRefreshTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// TokenService_ServiceDesc is the grpc.ServiceDesc for TokenService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var TokenService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "authorizer.token.v1.TokenService", + HandlerType: (*TokenServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateTokenValidation", + Handler: _TokenService_CreateTokenValidation_Handler, + }, + { + MethodName: "RevokeRefreshToken", + Handler: _TokenService_RevokeRefreshToken_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "authorizer/token/v1/token_service.proto", +} diff --git a/gen/go/authorizer/user/v1/user.pb.go b/gen/go/authorizer/user/v1/user.pb.go new file mode 100644 index 00000000..34b91ea6 --- /dev/null +++ b/gen/go/authorizer/user/v1/user.pb.go @@ -0,0 +1,348 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: authorizer/user/v1/user.proto + +package userv1 + +import ( + v1 "github.com/authorizerdev/authorizer/gen/go/authorizer/common/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// User mirrors the GraphQL User type. Field names match the existing +// JSON/GraphQL surface so REST callers see the same shape. +// +// The canonical resource name is either "users/me" (the caller) or +// "users/{id}". Other RPCs accept this string form via the `name` field on +// their requests. +type User struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Either email or phone_number is always present. + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` + EmailVerified bool `protobuf:"varint,3,opt,name=email_verified,json=emailVerified,proto3" json:"email_verified,omitempty"` + SignupMethods string `protobuf:"bytes,4,opt,name=signup_methods,json=signupMethods,proto3" json:"signup_methods,omitempty"` + GivenName string `protobuf:"bytes,5,opt,name=given_name,json=givenName,proto3" json:"given_name,omitempty"` + FamilyName string `protobuf:"bytes,6,opt,name=family_name,json=familyName,proto3" json:"family_name,omitempty"` + MiddleName string `protobuf:"bytes,7,opt,name=middle_name,json=middleName,proto3" json:"middle_name,omitempty"` + Nickname string `protobuf:"bytes,8,opt,name=nickname,proto3" json:"nickname,omitempty"` + // Defaults to email when unset. + PreferredUsername string `protobuf:"bytes,9,opt,name=preferred_username,json=preferredUsername,proto3" json:"preferred_username,omitempty"` + Gender string `protobuf:"bytes,10,opt,name=gender,proto3" json:"gender,omitempty"` + Birthdate string `protobuf:"bytes,11,opt,name=birthdate,proto3" json:"birthdate,omitempty"` + PhoneNumber string `protobuf:"bytes,12,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` + PhoneNumberVerified bool `protobuf:"varint,13,opt,name=phone_number_verified,json=phoneNumberVerified,proto3" json:"phone_number_verified,omitempty"` + Picture string `protobuf:"bytes,14,opt,name=picture,proto3" json:"picture,omitempty"` + Roles []string `protobuf:"bytes,15,rep,name=roles,proto3" json:"roles,omitempty"` + CreatedAt int64 `protobuf:"varint,16,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt int64 `protobuf:"varint,17,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + RevokedTimestamp int64 `protobuf:"varint,18,opt,name=revoked_timestamp,json=revokedTimestamp,proto3" json:"revoked_timestamp,omitempty"` + IsMultiFactorAuthEnabled bool `protobuf:"varint,19,opt,name=is_multi_factor_auth_enabled,json=isMultiFactorAuthEnabled,proto3" json:"is_multi_factor_auth_enabled,omitempty"` + // Free-form key/value bag — same as GraphQL `app_data: Map`. + AppData *v1.AppData `protobuf:"bytes,20,opt,name=app_data,json=appData,proto3" json:"app_data,omitempty"` +} + +func (x *User) Reset() { + *x = User{} + mi := &file_authorizer_user_v1_user_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*User) ProtoMessage() {} + +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_user_v1_user_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 User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_authorizer_user_v1_user_proto_rawDescGZIP(), []int{0} +} + +func (x *User) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *User) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *User) GetEmailVerified() bool { + if x != nil { + return x.EmailVerified + } + return false +} + +func (x *User) GetSignupMethods() string { + if x != nil { + return x.SignupMethods + } + return "" +} + +func (x *User) GetGivenName() string { + if x != nil { + return x.GivenName + } + return "" +} + +func (x *User) GetFamilyName() string { + if x != nil { + return x.FamilyName + } + return "" +} + +func (x *User) GetMiddleName() string { + if x != nil { + return x.MiddleName + } + return "" +} + +func (x *User) GetNickname() string { + if x != nil { + return x.Nickname + } + return "" +} + +func (x *User) GetPreferredUsername() string { + if x != nil { + return x.PreferredUsername + } + return "" +} + +func (x *User) GetGender() string { + if x != nil { + return x.Gender + } + return "" +} + +func (x *User) GetBirthdate() string { + if x != nil { + return x.Birthdate + } + return "" +} + +func (x *User) GetPhoneNumber() string { + if x != nil { + return x.PhoneNumber + } + return "" +} + +func (x *User) GetPhoneNumberVerified() bool { + if x != nil { + return x.PhoneNumberVerified + } + return false +} + +func (x *User) GetPicture() string { + if x != nil { + return x.Picture + } + return "" +} + +func (x *User) GetRoles() []string { + if x != nil { + return x.Roles + } + return nil +} + +func (x *User) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *User) GetUpdatedAt() int64 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +func (x *User) GetRevokedTimestamp() int64 { + if x != nil { + return x.RevokedTimestamp + } + return 0 +} + +func (x *User) GetIsMultiFactorAuthEnabled() bool { + if x != nil { + return x.IsMultiFactorAuthEnabled + } + return false +} + +func (x *User) GetAppData() *v1.AppData { + if x != nil { + return x.AppData + } + return nil +} + +var File_authorizer_user_v1_user_proto protoreflect.FileDescriptor + +var file_authorizer_user_v1_user_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, + 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, + 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc8, 0x05, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6d, + 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x73, + 0x69, 0x67, 0x6e, 0x75, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x69, 0x67, 0x6e, 0x75, 0x70, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x5f, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x70, 0x72, 0x65, + 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, + 0x61, 0x74, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x69, 0x72, 0x74, 0x68, + 0x64, 0x61, 0x74, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, + 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x15, 0x70, 0x68, 0x6f, 0x6e, 0x65, + 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, + 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x69, + 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x0f, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x72, 0x65, 0x76, + 0x6f, 0x6b, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x12, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x72, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x3e, 0x0a, 0x1c, 0x69, 0x73, 0x5f, 0x6d, 0x75, 0x6c, + 0x74, 0x69, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x69, 0x73, + 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x41, 0x75, 0x74, 0x68, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x38, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x5f, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x41, 0x70, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x61, 0x70, 0x70, 0x44, 0x61, 0x74, 0x61, + 0x42, 0xd3, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x55, 0x73, 0x65, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x64, + 0x65, 0x76, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x67, 0x65, + 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, + 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, + 0x03, 0x41, 0x55, 0x58, 0xaa, 0x02, 0x12, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x41, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, + 0x1e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x55, 0x73, 0x65, 0x72, + 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x14, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x3a, 0x3a, 0x55, 0x73, + 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_authorizer_user_v1_user_proto_rawDescOnce sync.Once + file_authorizer_user_v1_user_proto_rawDescData = file_authorizer_user_v1_user_proto_rawDesc +) + +func file_authorizer_user_v1_user_proto_rawDescGZIP() []byte { + file_authorizer_user_v1_user_proto_rawDescOnce.Do(func() { + file_authorizer_user_v1_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_authorizer_user_v1_user_proto_rawDescData) + }) + return file_authorizer_user_v1_user_proto_rawDescData +} + +var file_authorizer_user_v1_user_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_authorizer_user_v1_user_proto_goTypes = []any{ + (*User)(nil), // 0: authorizer.user.v1.User + (*v1.AppData)(nil), // 1: authorizer.common.v1.AppData +} +var file_authorizer_user_v1_user_proto_depIdxs = []int32{ + 1, // 0: authorizer.user.v1.User.app_data:type_name -> authorizer.common.v1.AppData + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] 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_authorizer_user_v1_user_proto_init() } +func file_authorizer_user_v1_user_proto_init() { + if File_authorizer_user_v1_user_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_authorizer_user_v1_user_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_authorizer_user_v1_user_proto_goTypes, + DependencyIndexes: file_authorizer_user_v1_user_proto_depIdxs, + MessageInfos: file_authorizer_user_v1_user_proto_msgTypes, + }.Build() + File_authorizer_user_v1_user_proto = out.File + file_authorizer_user_v1_user_proto_rawDesc = nil + file_authorizer_user_v1_user_proto_goTypes = nil + file_authorizer_user_v1_user_proto_depIdxs = nil +} diff --git a/gen/go/authorizer/user/v1/user_service.pb.go b/gen/go/authorizer/user/v1/user_service.pb.go new file mode 100644 index 00000000..9d1dac12 --- /dev/null +++ b/gen/go/authorizer/user/v1/user_service.pb.go @@ -0,0 +1,849 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: authorizer/user/v1/user_service.proto + +package userv1 + +import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + v1 "github.com/authorizerdev/authorizer/gen/go/authorizer/common/v1" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" + reflect "reflect" + sync "sync" +) + +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 CreateUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Email or phone_number must be set (validated at the handler). + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + PhoneNumber string `protobuf:"bytes,2,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` + Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` + ConfirmPassword string `protobuf:"bytes,4,opt,name=confirm_password,json=confirmPassword,proto3" json:"confirm_password,omitempty"` + GivenName string `protobuf:"bytes,5,opt,name=given_name,json=givenName,proto3" json:"given_name,omitempty"` + FamilyName string `protobuf:"bytes,6,opt,name=family_name,json=familyName,proto3" json:"family_name,omitempty"` + MiddleName string `protobuf:"bytes,7,opt,name=middle_name,json=middleName,proto3" json:"middle_name,omitempty"` + Nickname string `protobuf:"bytes,8,opt,name=nickname,proto3" json:"nickname,omitempty"` + Gender string `protobuf:"bytes,9,opt,name=gender,proto3" json:"gender,omitempty"` + Birthdate string `protobuf:"bytes,10,opt,name=birthdate,proto3" json:"birthdate,omitempty"` + Picture string `protobuf:"bytes,11,opt,name=picture,proto3" json:"picture,omitempty"` + Roles []string `protobuf:"bytes,12,rep,name=roles,proto3" json:"roles,omitempty"` + Scope []string `protobuf:"bytes,13,rep,name=scope,proto3" json:"scope,omitempty"` + RedirectUri string `protobuf:"bytes,14,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"` + IsMultiFactorAuthEnabled bool `protobuf:"varint,15,opt,name=is_multi_factor_auth_enabled,json=isMultiFactorAuthEnabled,proto3" json:"is_multi_factor_auth_enabled,omitempty"` + // OAuth2 authorization-code flow state echoed back via c_hash. + State string `protobuf:"bytes,16,opt,name=state,proto3" json:"state,omitempty"` + AppData *v1.AppData `protobuf:"bytes,17,opt,name=app_data,json=appData,proto3" json:"app_data,omitempty"` +} + +func (x *CreateUserRequest) Reset() { + *x = CreateUserRequest{} + mi := &file_authorizer_user_v1_user_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserRequest) ProtoMessage() {} + +func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_user_v1_user_service_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 CreateUserRequest.ProtoReflect.Descriptor instead. +func (*CreateUserRequest) Descriptor() ([]byte, []int) { + return file_authorizer_user_v1_user_service_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateUserRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *CreateUserRequest) GetPhoneNumber() string { + if x != nil { + return x.PhoneNumber + } + return "" +} + +func (x *CreateUserRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *CreateUserRequest) GetConfirmPassword() string { + if x != nil { + return x.ConfirmPassword + } + return "" +} + +func (x *CreateUserRequest) GetGivenName() string { + if x != nil { + return x.GivenName + } + return "" +} + +func (x *CreateUserRequest) GetFamilyName() string { + if x != nil { + return x.FamilyName + } + return "" +} + +func (x *CreateUserRequest) GetMiddleName() string { + if x != nil { + return x.MiddleName + } + return "" +} + +func (x *CreateUserRequest) GetNickname() string { + if x != nil { + return x.Nickname + } + return "" +} + +func (x *CreateUserRequest) GetGender() string { + if x != nil { + return x.Gender + } + return "" +} + +func (x *CreateUserRequest) GetBirthdate() string { + if x != nil { + return x.Birthdate + } + return "" +} + +func (x *CreateUserRequest) GetPicture() string { + if x != nil { + return x.Picture + } + return "" +} + +func (x *CreateUserRequest) GetRoles() []string { + if x != nil { + return x.Roles + } + return nil +} + +func (x *CreateUserRequest) GetScope() []string { + if x != nil { + return x.Scope + } + return nil +} + +func (x *CreateUserRequest) GetRedirectUri() string { + if x != nil { + return x.RedirectUri + } + return "" +} + +func (x *CreateUserRequest) GetIsMultiFactorAuthEnabled() bool { + if x != nil { + return x.IsMultiFactorAuthEnabled + } + return false +} + +func (x *CreateUserRequest) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *CreateUserRequest) GetAppData() *v1.AppData { + if x != nil { + return x.AppData + } + return nil +} + +type CreateUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Human-readable message describing the outcome (e.g. "Verification email + // sent" vs "Signed up successfully"). + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + ShouldShowEmailOtpScreen bool `protobuf:"varint,2,opt,name=should_show_email_otp_screen,json=shouldShowEmailOtpScreen,proto3" json:"should_show_email_otp_screen,omitempty"` + ShouldShowMobileOtpScreen bool `protobuf:"varint,3,opt,name=should_show_mobile_otp_screen,json=shouldShowMobileOtpScreen,proto3" json:"should_show_mobile_otp_screen,omitempty"` + ShouldShowTotpScreen bool `protobuf:"varint,4,opt,name=should_show_totp_screen,json=shouldShowTotpScreen,proto3" json:"should_show_totp_screen,omitempty"` + AccessToken string `protobuf:"bytes,5,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + IdToken string `protobuf:"bytes,6,opt,name=id_token,json=idToken,proto3" json:"id_token,omitempty"` + RefreshToken string `protobuf:"bytes,7,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` + ExpiresIn int64 `protobuf:"varint,8,opt,name=expires_in,json=expiresIn,proto3" json:"expires_in,omitempty"` + User *User `protobuf:"bytes,9,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *CreateUserResponse) Reset() { + *x = CreateUserResponse{} + mi := &file_authorizer_user_v1_user_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserResponse) ProtoMessage() {} + +func (x *CreateUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_user_v1_user_service_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 CreateUserResponse.ProtoReflect.Descriptor instead. +func (*CreateUserResponse) Descriptor() ([]byte, []int) { + return file_authorizer_user_v1_user_service_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateUserResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *CreateUserResponse) GetShouldShowEmailOtpScreen() bool { + if x != nil { + return x.ShouldShowEmailOtpScreen + } + return false +} + +func (x *CreateUserResponse) GetShouldShowMobileOtpScreen() bool { + if x != nil { + return x.ShouldShowMobileOtpScreen + } + return false +} + +func (x *CreateUserResponse) GetShouldShowTotpScreen() bool { + if x != nil { + return x.ShouldShowTotpScreen + } + return false +} + +func (x *CreateUserResponse) GetAccessToken() string { + if x != nil { + return x.AccessToken + } + return "" +} + +func (x *CreateUserResponse) GetIdToken() string { + if x != nil { + return x.IdToken + } + return "" +} + +func (x *CreateUserResponse) GetRefreshToken() string { + if x != nil { + return x.RefreshToken + } + return "" +} + +func (x *CreateUserResponse) GetExpiresIn() int64 { + if x != nil { + return x.ExpiresIn + } + return 0 +} + +func (x *CreateUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type GetUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Must be "users/me" on this v1 surface. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetUserRequest) Reset() { + *x = GetUserRequest{} + mi := &file_authorizer_user_v1_user_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserRequest) ProtoMessage() {} + +func (x *GetUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_user_v1_user_service_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 GetUserRequest.ProtoReflect.Descriptor instead. +func (*GetUserRequest) Descriptor() ([]byte, []int) { + return file_authorizer_user_v1_user_service_proto_rawDescGZIP(), []int{2} +} + +func (x *GetUserRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *GetUserResponse) Reset() { + *x = GetUserResponse{} + mi := &file_authorizer_user_v1_user_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserResponse) ProtoMessage() {} + +func (x *GetUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_user_v1_user_service_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 GetUserResponse.ProtoReflect.Descriptor instead. +func (*GetUserResponse) Descriptor() ([]byte, []int) { + return file_authorizer_user_v1_user_service_proto_rawDescGZIP(), []int{3} +} + +func (x *GetUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type UpdateUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The user to update. user.id should be "users/me" or omitted. + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + // Optional credential change. Validated cross-field by the handler. + OldPassword string `protobuf:"bytes,3,opt,name=old_password,json=oldPassword,proto3" json:"old_password,omitempty"` + NewPassword string `protobuf:"bytes,4,opt,name=new_password,json=newPassword,proto3" json:"new_password,omitempty"` + ConfirmNewPassword string `protobuf:"bytes,5,opt,name=confirm_new_password,json=confirmNewPassword,proto3" json:"confirm_new_password,omitempty"` +} + +func (x *UpdateUserRequest) Reset() { + *x = UpdateUserRequest{} + mi := &file_authorizer_user_v1_user_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserRequest) ProtoMessage() {} + +func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_user_v1_user_service_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 UpdateUserRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserRequest) Descriptor() ([]byte, []int) { + return file_authorizer_user_v1_user_service_proto_rawDescGZIP(), []int{4} +} + +func (x *UpdateUserRequest) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +func (x *UpdateUserRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +func (x *UpdateUserRequest) GetOldPassword() string { + if x != nil { + return x.OldPassword + } + return "" +} + +func (x *UpdateUserRequest) GetNewPassword() string { + if x != nil { + return x.NewPassword + } + return "" +} + +func (x *UpdateUserRequest) GetConfirmNewPassword() string { + if x != nil { + return x.ConfirmNewPassword + } + return "" +} + +type UpdateUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *UpdateUserResponse) Reset() { + *x = UpdateUserResponse{} + mi := &file_authorizer_user_v1_user_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserResponse) ProtoMessage() {} + +func (x *UpdateUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_user_v1_user_service_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 UpdateUserResponse.ProtoReflect.Descriptor instead. +func (*UpdateUserResponse) Descriptor() ([]byte, []int) { + return file_authorizer_user_v1_user_service_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type DeleteUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Must be "users/me" on this v1 surface. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *DeleteUserRequest) Reset() { + *x = DeleteUserRequest{} + mi := &file_authorizer_user_v1_user_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserRequest) ProtoMessage() {} + +func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_user_v1_user_service_proto_msgTypes[6] + 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 DeleteUserRequest.ProtoReflect.Descriptor instead. +func (*DeleteUserRequest) Descriptor() ([]byte, []int) { + return file_authorizer_user_v1_user_service_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteUserRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteUserResponse) Reset() { + *x = DeleteUserResponse{} + mi := &file_authorizer_user_v1_user_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserResponse) ProtoMessage() {} + +func (x *DeleteUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_user_v1_user_service_proto_msgTypes[7] + 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 DeleteUserResponse.ProtoReflect.Descriptor instead. +func (*DeleteUserResponse) Descriptor() ([]byte, []int) { + return file_authorizer_user_v1_user_service_proto_rawDescGZIP(), []int{7} +} + +var File_authorizer_user_v1_user_service_proto protoreflect.FileDescriptor + +var file_authorizer_user_v1_user_service_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, + 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, + 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x2e, 0x70, 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, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, + 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x61, + 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x20, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x75, + 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xec, 0x04, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x18, 0xc0, 0x02, + 0x60, 0x01, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x2a, 0x0a, 0x0c, 0x70, 0x68, 0x6f, + 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x18, 0x20, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, + 0x18, 0x80, 0x01, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x35, 0x0a, + 0x10, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, + 0x18, 0x80, 0x01, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, + 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x69, 0x72, + 0x74, 0x68, 0x64, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x69, + 0x72, 0x74, 0x68, 0x64, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x69, 0x63, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x21, 0x0a, + 0x0c, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x0e, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x55, 0x72, 0x69, + 0x12, 0x3e, 0x0a, 0x1c, 0x69, 0x73, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x5f, 0x66, 0x61, 0x63, + 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x69, 0x73, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x46, + 0x61, 0x63, 0x74, 0x6f, 0x72, 0x41, 0x75, 0x74, 0x68, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x38, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x5f, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x41, 0x70, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x61, 0x70, 0x70, 0x44, 0x61, 0x74, 0x61, + 0x22, 0x97, 0x03, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x3e, 0x0a, 0x1c, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x5f, 0x73, 0x68, 0x6f, 0x77, + 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x6f, 0x74, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x65, 0x65, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x53, + 0x68, 0x6f, 0x77, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x4f, 0x74, 0x70, 0x53, 0x63, 0x72, 0x65, 0x65, + 0x6e, 0x12, 0x40, 0x0a, 0x1d, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x5f, 0x73, 0x68, 0x6f, 0x77, + 0x5f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x5f, 0x6f, 0x74, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x65, + 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x19, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, + 0x53, 0x68, 0x6f, 0x77, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x4f, 0x74, 0x70, 0x53, 0x63, 0x72, + 0x65, 0x65, 0x6e, 0x12, 0x35, 0x0a, 0x17, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x5f, 0x73, 0x68, + 0x6f, 0x77, 0x5f, 0x74, 0x6f, 0x74, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x77, + 0x54, 0x6f, 0x74, 0x70, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x19, 0x0a, + 0x08, 0x69, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x69, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x66, 0x72, + 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1d, 0x0a, + 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, 0x69, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x49, 0x6e, 0x12, 0x2c, 0x0a, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x48, 0x0a, 0x0e, 0x47, 0x65, + 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x22, 0xba, 0x48, 0x1f, 0x72, + 0x1d, 0x32, 0x1b, 0x5e, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x28, 0x6d, 0x65, 0x7c, 0x5b, 0x41, + 0x2d, 0x5a, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x2d, 0x5d, 0x2b, 0x29, 0x24, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3f, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0xfe, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x04, 0x75, + 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x04, 0x75, 0x73, 0x65, + 0x72, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, + 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x12, 0x21, + 0x0a, 0x0c, 0x6f, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x6c, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x65, 0x77, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x65, 0x77, 0x50, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x5f, + 0x6e, 0x65, 0x77, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x4e, 0x65, 0x77, 0x50, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x42, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x4b, 0x0a, 0x11, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x36, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x22, 0xba, + 0x48, 0x1f, 0x72, 0x1d, 0x32, 0x1b, 0x5e, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x28, 0x6d, 0x65, + 0x7c, 0x5b, 0x41, 0x2d, 0x5a, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x2d, 0x5d, 0x2b, 0x29, + 0x24, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf6, 0x03, + 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7d, 0x0a, + 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, + 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x92, 0xb5, 0x18, 0x00, + 0x98, 0xb5, 0x18, 0x01, 0xa0, 0xb5, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x3a, 0x01, + 0x2a, 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x6e, 0x0a, 0x07, + 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x1a, 0x92, 0xb5, 0x18, 0x02, 0x08, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, + 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x6d, 0x65, 0x12, 0x7b, 0x0a, 0x0a, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x26, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, + 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x98, 0xb5, 0x18, 0x01, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x32, 0x0c, 0x2f, 0x76, 0x31, + 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x6d, 0x65, 0x12, 0x7b, 0x0a, 0x0a, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, + 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x92, 0xb5, 0x18, 0x02, 0x18, 0x01, 0x98, 0xb5, + 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x2a, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, + 0x65, 0x72, 0x73, 0x2f, 0x6d, 0x65, 0x42, 0xda, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, + 0x31, 0x42, 0x10, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x64, 0x65, 0x76, 0x2f, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, + 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, + 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x55, + 0x58, 0xaa, 0x02, 0x12, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x41, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x3a, 0x3a, 0x55, 0x73, 0x65, 0x72, 0x3a, + 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_authorizer_user_v1_user_service_proto_rawDescOnce sync.Once + file_authorizer_user_v1_user_service_proto_rawDescData = file_authorizer_user_v1_user_service_proto_rawDesc +) + +func file_authorizer_user_v1_user_service_proto_rawDescGZIP() []byte { + file_authorizer_user_v1_user_service_proto_rawDescOnce.Do(func() { + file_authorizer_user_v1_user_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authorizer_user_v1_user_service_proto_rawDescData) + }) + return file_authorizer_user_v1_user_service_proto_rawDescData +} + +var file_authorizer_user_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_authorizer_user_v1_user_service_proto_goTypes = []any{ + (*CreateUserRequest)(nil), // 0: authorizer.user.v1.CreateUserRequest + (*CreateUserResponse)(nil), // 1: authorizer.user.v1.CreateUserResponse + (*GetUserRequest)(nil), // 2: authorizer.user.v1.GetUserRequest + (*GetUserResponse)(nil), // 3: authorizer.user.v1.GetUserResponse + (*UpdateUserRequest)(nil), // 4: authorizer.user.v1.UpdateUserRequest + (*UpdateUserResponse)(nil), // 5: authorizer.user.v1.UpdateUserResponse + (*DeleteUserRequest)(nil), // 6: authorizer.user.v1.DeleteUserRequest + (*DeleteUserResponse)(nil), // 7: authorizer.user.v1.DeleteUserResponse + (*v1.AppData)(nil), // 8: authorizer.common.v1.AppData + (*User)(nil), // 9: authorizer.user.v1.User + (*fieldmaskpb.FieldMask)(nil), // 10: google.protobuf.FieldMask +} +var file_authorizer_user_v1_user_service_proto_depIdxs = []int32{ + 8, // 0: authorizer.user.v1.CreateUserRequest.app_data:type_name -> authorizer.common.v1.AppData + 9, // 1: authorizer.user.v1.CreateUserResponse.user:type_name -> authorizer.user.v1.User + 9, // 2: authorizer.user.v1.GetUserResponse.user:type_name -> authorizer.user.v1.User + 9, // 3: authorizer.user.v1.UpdateUserRequest.user:type_name -> authorizer.user.v1.User + 10, // 4: authorizer.user.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask + 9, // 5: authorizer.user.v1.UpdateUserResponse.user:type_name -> authorizer.user.v1.User + 0, // 6: authorizer.user.v1.UserService.CreateUser:input_type -> authorizer.user.v1.CreateUserRequest + 2, // 7: authorizer.user.v1.UserService.GetUser:input_type -> authorizer.user.v1.GetUserRequest + 4, // 8: authorizer.user.v1.UserService.UpdateUser:input_type -> authorizer.user.v1.UpdateUserRequest + 6, // 9: authorizer.user.v1.UserService.DeleteUser:input_type -> authorizer.user.v1.DeleteUserRequest + 1, // 10: authorizer.user.v1.UserService.CreateUser:output_type -> authorizer.user.v1.CreateUserResponse + 3, // 11: authorizer.user.v1.UserService.GetUser:output_type -> authorizer.user.v1.GetUserResponse + 5, // 12: authorizer.user.v1.UserService.UpdateUser:output_type -> authorizer.user.v1.UpdateUserResponse + 7, // 13: authorizer.user.v1.UserService.DeleteUser:output_type -> authorizer.user.v1.DeleteUserResponse + 10, // [10:14] is the sub-list for method output_type + 6, // [6:10] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_authorizer_user_v1_user_service_proto_init() } +func file_authorizer_user_v1_user_service_proto_init() { + if File_authorizer_user_v1_user_service_proto != nil { + return + } + file_authorizer_user_v1_user_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_authorizer_user_v1_user_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_authorizer_user_v1_user_service_proto_goTypes, + DependencyIndexes: file_authorizer_user_v1_user_service_proto_depIdxs, + MessageInfos: file_authorizer_user_v1_user_service_proto_msgTypes, + }.Build() + File_authorizer_user_v1_user_service_proto = out.File + file_authorizer_user_v1_user_service_proto_rawDesc = nil + file_authorizer_user_v1_user_service_proto_goTypes = nil + file_authorizer_user_v1_user_service_proto_depIdxs = nil +} diff --git a/gen/go/authorizer/user/v1/user_service.pb.gw.go b/gen/go/authorizer/user/v1/user_service.pb.gw.go new file mode 100644 index 00000000..dc0298b5 --- /dev/null +++ b/gen/go/authorizer/user/v1/user_service.pb.gw.go @@ -0,0 +1,455 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: authorizer/user/v1/user_service.proto + +/* +Package userv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package userv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_UserService_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateUserRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_UserService_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateUserRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateUser(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_UserService_GetUser_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetUserRequest + 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_UserService_GetUser_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetUserRequest + 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_UserService_GetUser_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetUser(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_UserService_UpdateUser_0 = &utilities.DoubleArray{Encoding: map[string]int{"user": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_UserService_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateUserRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.User); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.User); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUser_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_UserService_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateUserRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.User); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.User); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUser_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateUser(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_UserService_DeleteUser_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_UserService_DeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteUserRequest + 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_UserService_DeleteUser_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DeleteUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_UserService_DeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteUserRequest + 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_UserService_DeleteUser_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DeleteUser(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux". +// UnaryRPC :call UserServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error { + + mux.Handle("POST", pattern_UserService_CreateUser_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, "/authorizer.user.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/v1/users")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_CreateUser_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_UserService_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_UserService_GetUser_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, "/authorizer.user.v1.UserService/GetUser", runtime.WithHTTPPathPattern("/v1/users/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_GetUser_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_UserService_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_UserService_UpdateUser_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, "/authorizer.user.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/v1/users/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_UpdateUser_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_UserService_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_UserService_DeleteUser_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, "/authorizer.user.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/v1/users/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_DeleteUser_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_UserService_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterUserServiceHandlerFromEndpoint is same as RegisterUserServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterUserServiceHandler(ctx, mux, conn) +} + +// RegisterUserServiceHandler registers the http handlers for service UserService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterUserServiceHandlerClient(ctx, mux, NewUserServiceClient(conn)) +} + +// RegisterUserServiceHandlerClient registers the http handlers for service UserService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "UserServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error { + + mux.Handle("POST", pattern_UserService_CreateUser_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, "/authorizer.user.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/v1/users")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_CreateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserService_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_UserService_GetUser_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, "/authorizer.user.v1.UserService/GetUser", runtime.WithHTTPPathPattern("/v1/users/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_GetUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserService_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_UserService_UpdateUser_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, "/authorizer.user.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/v1/users/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_UpdateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserService_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_UserService_DeleteUser_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, "/authorizer.user.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/v1/users/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_DeleteUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserService_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_UserService_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, "")) + + pattern_UserService_GetUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "users", "me"}, "")) + + pattern_UserService_UpdateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "users", "me"}, "")) + + pattern_UserService_DeleteUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "users", "me"}, "")) +) + +var ( + forward_UserService_CreateUser_0 = runtime.ForwardResponseMessage + + forward_UserService_GetUser_0 = runtime.ForwardResponseMessage + + forward_UserService_UpdateUser_0 = runtime.ForwardResponseMessage + + forward_UserService_DeleteUser_0 = runtime.ForwardResponseMessage +) diff --git a/gen/go/authorizer/user/v1/user_service_grpc.pb.go b/gen/go/authorizer/user/v1/user_service_grpc.pb.go new file mode 100644 index 00000000..bfd16bc7 --- /dev/null +++ b/gen/go/authorizer/user/v1/user_service_grpc.pb.go @@ -0,0 +1,265 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: authorizer/user/v1/user_service.proto + +package userv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + UserService_CreateUser_FullMethodName = "/authorizer.user.v1.UserService/CreateUser" + UserService_GetUser_FullMethodName = "/authorizer.user.v1.UserService/GetUser" + UserService_UpdateUser_FullMethodName = "/authorizer.user.v1.UserService/UpdateUser" + UserService_DeleteUser_FullMethodName = "/authorizer.user.v1.UserService/DeleteUser" +) + +// UserServiceClient is the client API for UserService service. +// +// 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. +// +// UserService manages the User resource. Self vs admin is expressed via the +// resource-name pattern: "users/me" refers to the caller; "users/{id}" +// refers to any user (admin-only paths). On this v1 surface only "users/me" +// is exposed — admin operations live on GraphQL. +type UserServiceClient interface { + // CreateUser registers a new user account. Public — requires sign-up + // enabled in server config. On success returns tokens and (for browser + // callers) Set-Cookie headers. + CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) + // GetUser returns a single user. On this surface, only name="users/me" is + // accepted; admin reads remain on GraphQL. + GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) + // UpdateUser patches a user. On this surface, only name="users/me" is + // accepted. The optional field_mask controls which fields are updated. + UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error) + // DeleteUser deactivates the caller's account (soft delete). All of the + // user's refresh tokens are revoked as a side effect. OAuth has no + // standard concept of account deactivation — this method is the typed + // equivalent of SCIM `PATCH /Users/{id} {active:false}`. + DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) +} + +type userServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient { + return &userServiceClient{cc} +} + +func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateUserResponse) + err := c.cc.Invoke(ctx, UserService_CreateUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserResponse) + err := c.cc.Invoke(ctx, UserService_GetUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateUserResponse) + err := c.cc.Invoke(ctx, UserService_UpdateUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteUserResponse) + err := c.cc.Invoke(ctx, UserService_DeleteUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// UserServiceServer is the server API for UserService service. +// All implementations should embed UnimplementedUserServiceServer +// for forward compatibility. +// +// UserService manages the User resource. Self vs admin is expressed via the +// resource-name pattern: "users/me" refers to the caller; "users/{id}" +// refers to any user (admin-only paths). On this v1 surface only "users/me" +// is exposed — admin operations live on GraphQL. +type UserServiceServer interface { + // CreateUser registers a new user account. Public — requires sign-up + // enabled in server config. On success returns tokens and (for browser + // callers) Set-Cookie headers. + CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) + // GetUser returns a single user. On this surface, only name="users/me" is + // accepted; admin reads remain on GraphQL. + GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) + // UpdateUser patches a user. On this surface, only name="users/me" is + // accepted. The optional field_mask controls which fields are updated. + UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error) + // DeleteUser deactivates the caller's account (soft delete). All of the + // user's refresh tokens are revoked as a side effect. OAuth has no + // standard concept of account deactivation — this method is the typed + // equivalent of SCIM `PATCH /Users/{id} {active:false}`. + DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) +} + +// UnimplementedUserServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedUserServiceServer struct{} + +func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented") +} +func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") +} +func (UnimplementedUserServiceServer) UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented") +} +func (UnimplementedUserServiceServer) DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteUser not implemented") +} +func (UnimplementedUserServiceServer) testEmbeddedByValue() {} + +// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to UserServiceServer will +// result in compilation errors. +type UnsafeUserServiceServer interface { + mustEmbedUnimplementedUserServiceServer() +} + +func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) { + // If the following call pancis, it indicates UnimplementedUserServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&UserService_ServiceDesc, srv) +} + +func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).CreateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_CreateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).GetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_GetUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).GetUser(ctx, req.(*GetUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).UpdateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_UpdateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).UpdateUser(ctx, req.(*UpdateUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).DeleteUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_DeleteUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).DeleteUser(ctx, req.(*DeleteUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var UserService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "authorizer.user.v1.UserService", + HandlerType: (*UserServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateUser", + Handler: _UserService_CreateUser_Handler, + }, + { + MethodName: "GetUser", + Handler: _UserService_GetUser_Handler, + }, + { + MethodName: "UpdateUser", + Handler: _UserService_UpdateUser_Handler, + }, + { + MethodName: "DeleteUser", + Handler: _UserService_DeleteUser_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "authorizer/user/v1/user_service.proto", +} diff --git a/gen/go/authorizer/verification/v1/email_verification_service.pb.go b/gen/go/authorizer/verification/v1/email_verification_service.pb.go new file mode 100644 index 00000000..cd1f30ab --- /dev/null +++ b/gen/go/authorizer/verification/v1/email_verification_service.pb.go @@ -0,0 +1,376 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: authorizer/verification/v1/email_verification_service.proto + +package verificationv1 + +import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + _ "github.com/authorizerdev/authorizer/gen/go/authorizer/common/v1" + v1 "github.com/authorizerdev/authorizer/gen/go/authorizer/session/v1" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 CreateEmailVerificationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + // Verification identifier (typeof verification, e.g. basic-auth-signup). + Identifier string `protobuf:"bytes,2,opt,name=identifier,proto3" json:"identifier,omitempty"` + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` +} + +func (x *CreateEmailVerificationRequest) Reset() { + *x = CreateEmailVerificationRequest{} + mi := &file_authorizer_verification_v1_email_verification_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateEmailVerificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateEmailVerificationRequest) ProtoMessage() {} + +func (x *CreateEmailVerificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_email_verification_service_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 CreateEmailVerificationRequest.ProtoReflect.Descriptor instead. +func (*CreateEmailVerificationRequest) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_email_verification_service_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateEmailVerificationRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *CreateEmailVerificationRequest) GetIdentifier() string { + if x != nil { + return x.Identifier + } + return "" +} + +func (x *CreateEmailVerificationRequest) GetState() string { + if x != nil { + return x.State + } + return "" +} + +type CreateEmailVerificationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *CreateEmailVerificationResponse) Reset() { + *x = CreateEmailVerificationResponse{} + mi := &file_authorizer_verification_v1_email_verification_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateEmailVerificationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateEmailVerificationResponse) ProtoMessage() {} + +func (x *CreateEmailVerificationResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_email_verification_service_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 CreateEmailVerificationResponse.ProtoReflect.Descriptor instead. +func (*CreateEmailVerificationResponse) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_email_verification_service_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateEmailVerificationResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ConfirmEmailVerificationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` +} + +func (x *ConfirmEmailVerificationRequest) Reset() { + *x = ConfirmEmailVerificationRequest{} + mi := &file_authorizer_verification_v1_email_verification_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfirmEmailVerificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfirmEmailVerificationRequest) ProtoMessage() {} + +func (x *ConfirmEmailVerificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_email_verification_service_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 ConfirmEmailVerificationRequest.ProtoReflect.Descriptor instead. +func (*ConfirmEmailVerificationRequest) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_email_verification_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ConfirmEmailVerificationRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *ConfirmEmailVerificationRequest) GetState() string { + if x != nil { + return x.State + } + return "" +} + +type ConfirmEmailVerificationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Session *v1.Session `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"` +} + +func (x *ConfirmEmailVerificationResponse) Reset() { + *x = ConfirmEmailVerificationResponse{} + mi := &file_authorizer_verification_v1_email_verification_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfirmEmailVerificationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfirmEmailVerificationResponse) ProtoMessage() {} + +func (x *ConfirmEmailVerificationResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_email_verification_service_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 ConfirmEmailVerificationResponse.ProtoReflect.Descriptor instead. +func (*ConfirmEmailVerificationResponse) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_email_verification_service_proto_rawDescGZIP(), []int{3} +} + +func (x *ConfirmEmailVerificationResponse) GetSession() *v1.Session { + if x != nil { + return x.Session + } + return nil +} + +var File_authorizer_verification_v1_email_verification_service_proto protoreflect.FileDescriptor + +var file_authorizer_verification_v1_email_verification_service_proto_rawDesc = []byte{ + 0x0a, 0x3b, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x6d, 0x61, + 0x69, 0x6c, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x2e, 0x70, 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, 0x74, 0x6f, 0x1a, 0x26, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x81, 0x01, 0x0a, 0x1e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6d, 0x61, 0x69, + 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x18, 0xc0, 0x02, 0x60, 0x01, 0x52, + 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x27, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, + 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x3b, 0x0a, 0x1f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, + 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x22, 0x56, 0x0a, 0x1f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x45, 0x6d, 0x61, + 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x05, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x5c, 0x0a, 0x20, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, + 0x0a, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, + 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0xa3, 0x03, 0x0a, 0x18, 0x45, 0x6d, 0x61, + 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xba, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x3a, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0xa0, 0xb5, 0x18, 0x01, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x3a, 0x01, 0x2a, 0x22, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x2d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0xc9, 0x01, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x45, 0x6d, + 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x3b, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x72, 0x6d, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3c, 0x2e, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, + 0x6d, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x98, 0xb5, 0x18, 0x01, + 0xa0, 0xb5, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x01, 0x2a, 0x1a, 0x1f, 0x2f, + 0x76, 0x31, 0x2f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x2d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x7d, 0x42, 0x9f, + 0x02, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x42, 0x1d, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x54, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x64, 0x65, 0x76, 0x2f, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x56, 0x58, 0xaa, 0x02, + 0x1a, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1a, 0x41, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x26, 0x41, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x1c, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x3a, 0x3a, + 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_authorizer_verification_v1_email_verification_service_proto_rawDescOnce sync.Once + file_authorizer_verification_v1_email_verification_service_proto_rawDescData = file_authorizer_verification_v1_email_verification_service_proto_rawDesc +) + +func file_authorizer_verification_v1_email_verification_service_proto_rawDescGZIP() []byte { + file_authorizer_verification_v1_email_verification_service_proto_rawDescOnce.Do(func() { + file_authorizer_verification_v1_email_verification_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authorizer_verification_v1_email_verification_service_proto_rawDescData) + }) + return file_authorizer_verification_v1_email_verification_service_proto_rawDescData +} + +var file_authorizer_verification_v1_email_verification_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_authorizer_verification_v1_email_verification_service_proto_goTypes = []any{ + (*CreateEmailVerificationRequest)(nil), // 0: authorizer.verification.v1.CreateEmailVerificationRequest + (*CreateEmailVerificationResponse)(nil), // 1: authorizer.verification.v1.CreateEmailVerificationResponse + (*ConfirmEmailVerificationRequest)(nil), // 2: authorizer.verification.v1.ConfirmEmailVerificationRequest + (*ConfirmEmailVerificationResponse)(nil), // 3: authorizer.verification.v1.ConfirmEmailVerificationResponse + (*v1.Session)(nil), // 4: authorizer.session.v1.Session +} +var file_authorizer_verification_v1_email_verification_service_proto_depIdxs = []int32{ + 4, // 0: authorizer.verification.v1.ConfirmEmailVerificationResponse.session:type_name -> authorizer.session.v1.Session + 0, // 1: authorizer.verification.v1.EmailVerificationService.CreateEmailVerification:input_type -> authorizer.verification.v1.CreateEmailVerificationRequest + 2, // 2: authorizer.verification.v1.EmailVerificationService.ConfirmEmailVerification:input_type -> authorizer.verification.v1.ConfirmEmailVerificationRequest + 1, // 3: authorizer.verification.v1.EmailVerificationService.CreateEmailVerification:output_type -> authorizer.verification.v1.CreateEmailVerificationResponse + 3, // 4: authorizer.verification.v1.EmailVerificationService.ConfirmEmailVerification:output_type -> authorizer.verification.v1.ConfirmEmailVerificationResponse + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] 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_authorizer_verification_v1_email_verification_service_proto_init() } +func file_authorizer_verification_v1_email_verification_service_proto_init() { + if File_authorizer_verification_v1_email_verification_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_authorizer_verification_v1_email_verification_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_authorizer_verification_v1_email_verification_service_proto_goTypes, + DependencyIndexes: file_authorizer_verification_v1_email_verification_service_proto_depIdxs, + MessageInfos: file_authorizer_verification_v1_email_verification_service_proto_msgTypes, + }.Build() + File_authorizer_verification_v1_email_verification_service_proto = out.File + file_authorizer_verification_v1_email_verification_service_proto_rawDesc = nil + file_authorizer_verification_v1_email_verification_service_proto_goTypes = nil + file_authorizer_verification_v1_email_verification_service_proto_depIdxs = nil +} diff --git a/gen/go/authorizer/verification/v1/email_verification_service.pb.gw.go b/gen/go/authorizer/verification/v1/email_verification_service.pb.gw.go new file mode 100644 index 00000000..bfe8176b --- /dev/null +++ b/gen/go/authorizer/verification/v1/email_verification_service.pb.gw.go @@ -0,0 +1,275 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: authorizer/verification/v1/email_verification_service.proto + +/* +Package verificationv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package verificationv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_EmailVerificationService_CreateEmailVerification_0(ctx context.Context, marshaler runtime.Marshaler, client EmailVerificationServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateEmailVerificationRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateEmailVerification(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_EmailVerificationService_CreateEmailVerification_0(ctx context.Context, marshaler runtime.Marshaler, server EmailVerificationServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateEmailVerificationRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateEmailVerification(ctx, &protoReq) + return msg, metadata, err + +} + +func request_EmailVerificationService_ConfirmEmailVerification_0(ctx context.Context, marshaler runtime.Marshaler, client EmailVerificationServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ConfirmEmailVerificationRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["token"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "token") + } + + protoReq.Token, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "token", err) + } + + msg, err := client.ConfirmEmailVerification(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_EmailVerificationService_ConfirmEmailVerification_0(ctx context.Context, marshaler runtime.Marshaler, server EmailVerificationServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ConfirmEmailVerificationRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["token"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "token") + } + + protoReq.Token, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "token", err) + } + + msg, err := server.ConfirmEmailVerification(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterEmailVerificationServiceHandlerServer registers the http handlers for service EmailVerificationService to "mux". +// UnaryRPC :call EmailVerificationServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterEmailVerificationServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterEmailVerificationServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EmailVerificationServiceServer) error { + + mux.Handle("POST", pattern_EmailVerificationService_CreateEmailVerification_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, "/authorizer.verification.v1.EmailVerificationService/CreateEmailVerification", runtime.WithHTTPPathPattern("/v1/email-verifications")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_EmailVerificationService_CreateEmailVerification_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_EmailVerificationService_CreateEmailVerification_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_EmailVerificationService_ConfirmEmailVerification_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, "/authorizer.verification.v1.EmailVerificationService/ConfirmEmailVerification", runtime.WithHTTPPathPattern("/v1/email-verifications/{token}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_EmailVerificationService_ConfirmEmailVerification_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_EmailVerificationService_ConfirmEmailVerification_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterEmailVerificationServiceHandlerFromEndpoint is same as RegisterEmailVerificationServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterEmailVerificationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterEmailVerificationServiceHandler(ctx, mux, conn) +} + +// RegisterEmailVerificationServiceHandler registers the http handlers for service EmailVerificationService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterEmailVerificationServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterEmailVerificationServiceHandlerClient(ctx, mux, NewEmailVerificationServiceClient(conn)) +} + +// RegisterEmailVerificationServiceHandlerClient registers the http handlers for service EmailVerificationService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EmailVerificationServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EmailVerificationServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "EmailVerificationServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterEmailVerificationServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EmailVerificationServiceClient) error { + + mux.Handle("POST", pattern_EmailVerificationService_CreateEmailVerification_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, "/authorizer.verification.v1.EmailVerificationService/CreateEmailVerification", runtime.WithHTTPPathPattern("/v1/email-verifications")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_EmailVerificationService_CreateEmailVerification_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_EmailVerificationService_CreateEmailVerification_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_EmailVerificationService_ConfirmEmailVerification_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, "/authorizer.verification.v1.EmailVerificationService/ConfirmEmailVerification", runtime.WithHTTPPathPattern("/v1/email-verifications/{token}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_EmailVerificationService_ConfirmEmailVerification_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_EmailVerificationService_ConfirmEmailVerification_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_EmailVerificationService_CreateEmailVerification_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "email-verifications"}, "")) + + pattern_EmailVerificationService_ConfirmEmailVerification_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "email-verifications", "token"}, "")) +) + +var ( + forward_EmailVerificationService_CreateEmailVerification_0 = runtime.ForwardResponseMessage + + forward_EmailVerificationService_ConfirmEmailVerification_0 = runtime.ForwardResponseMessage +) diff --git a/gen/go/authorizer/verification/v1/email_verification_service_grpc.pb.go b/gen/go/authorizer/verification/v1/email_verification_service_grpc.pb.go new file mode 100644 index 00000000..1f190314 --- /dev/null +++ b/gen/go/authorizer/verification/v1/email_verification_service_grpc.pb.go @@ -0,0 +1,175 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: authorizer/verification/v1/email_verification_service.proto + +package verificationv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + EmailVerificationService_CreateEmailVerification_FullMethodName = "/authorizer.verification.v1.EmailVerificationService/CreateEmailVerification" + EmailVerificationService_ConfirmEmailVerification_FullMethodName = "/authorizer.verification.v1.EmailVerificationService/ConfirmEmailVerification" +) + +// EmailVerificationServiceClient is the client API for EmailVerificationService service. +// +// 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. +// +// EmailVerificationService models the email-verification challenge as a +// resource. Create dispatches (or re-dispatches) a verification email; +// Confirm completes the verification with the token from the email link. +type EmailVerificationServiceClient interface { + // CreateEmailVerification (re)sends the verification email for an + // unverified address. Returns 201; idempotent within a short window. + CreateEmailVerification(ctx context.Context, in *CreateEmailVerificationRequest, opts ...grpc.CallOption) (*CreateEmailVerificationResponse, error) + // ConfirmEmailVerification marks the verification complete. Returns a + // Session when the original signup was a self-sign-up flow (so the user + // is logged in immediately); otherwise returns the empty Session. + ConfirmEmailVerification(ctx context.Context, in *ConfirmEmailVerificationRequest, opts ...grpc.CallOption) (*ConfirmEmailVerificationResponse, error) +} + +type emailVerificationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewEmailVerificationServiceClient(cc grpc.ClientConnInterface) EmailVerificationServiceClient { + return &emailVerificationServiceClient{cc} +} + +func (c *emailVerificationServiceClient) CreateEmailVerification(ctx context.Context, in *CreateEmailVerificationRequest, opts ...grpc.CallOption) (*CreateEmailVerificationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateEmailVerificationResponse) + err := c.cc.Invoke(ctx, EmailVerificationService_CreateEmailVerification_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *emailVerificationServiceClient) ConfirmEmailVerification(ctx context.Context, in *ConfirmEmailVerificationRequest, opts ...grpc.CallOption) (*ConfirmEmailVerificationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ConfirmEmailVerificationResponse) + err := c.cc.Invoke(ctx, EmailVerificationService_ConfirmEmailVerification_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// EmailVerificationServiceServer is the server API for EmailVerificationService service. +// All implementations should embed UnimplementedEmailVerificationServiceServer +// for forward compatibility. +// +// EmailVerificationService models the email-verification challenge as a +// resource. Create dispatches (or re-dispatches) a verification email; +// Confirm completes the verification with the token from the email link. +type EmailVerificationServiceServer interface { + // CreateEmailVerification (re)sends the verification email for an + // unverified address. Returns 201; idempotent within a short window. + CreateEmailVerification(context.Context, *CreateEmailVerificationRequest) (*CreateEmailVerificationResponse, error) + // ConfirmEmailVerification marks the verification complete. Returns a + // Session when the original signup was a self-sign-up flow (so the user + // is logged in immediately); otherwise returns the empty Session. + ConfirmEmailVerification(context.Context, *ConfirmEmailVerificationRequest) (*ConfirmEmailVerificationResponse, error) +} + +// UnimplementedEmailVerificationServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedEmailVerificationServiceServer struct{} + +func (UnimplementedEmailVerificationServiceServer) CreateEmailVerification(context.Context, *CreateEmailVerificationRequest) (*CreateEmailVerificationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateEmailVerification not implemented") +} +func (UnimplementedEmailVerificationServiceServer) ConfirmEmailVerification(context.Context, *ConfirmEmailVerificationRequest) (*ConfirmEmailVerificationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfirmEmailVerification not implemented") +} +func (UnimplementedEmailVerificationServiceServer) testEmbeddedByValue() {} + +// UnsafeEmailVerificationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to EmailVerificationServiceServer will +// result in compilation errors. +type UnsafeEmailVerificationServiceServer interface { + mustEmbedUnimplementedEmailVerificationServiceServer() +} + +func RegisterEmailVerificationServiceServer(s grpc.ServiceRegistrar, srv EmailVerificationServiceServer) { + // If the following call pancis, it indicates UnimplementedEmailVerificationServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&EmailVerificationService_ServiceDesc, srv) +} + +func _EmailVerificationService_CreateEmailVerification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateEmailVerificationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EmailVerificationServiceServer).CreateEmailVerification(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: EmailVerificationService_CreateEmailVerification_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EmailVerificationServiceServer).CreateEmailVerification(ctx, req.(*CreateEmailVerificationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _EmailVerificationService_ConfirmEmailVerification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfirmEmailVerificationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EmailVerificationServiceServer).ConfirmEmailVerification(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: EmailVerificationService_ConfirmEmailVerification_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EmailVerificationServiceServer).ConfirmEmailVerification(ctx, req.(*ConfirmEmailVerificationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// EmailVerificationService_ServiceDesc is the grpc.ServiceDesc for EmailVerificationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var EmailVerificationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "authorizer.verification.v1.EmailVerificationService", + HandlerType: (*EmailVerificationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateEmailVerification", + Handler: _EmailVerificationService_CreateEmailVerification_Handler, + }, + { + MethodName: "ConfirmEmailVerification", + Handler: _EmailVerificationService_ConfirmEmailVerification_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "authorizer/verification/v1/email_verification_service.proto", +} diff --git a/gen/go/authorizer/verification/v1/otp_challenge_service.pb.go b/gen/go/authorizer/verification/v1/otp_challenge_service.pb.go new file mode 100644 index 00000000..a2ea35f5 --- /dev/null +++ b/gen/go/authorizer/verification/v1/otp_challenge_service.pb.go @@ -0,0 +1,417 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: authorizer/verification/v1/otp_challenge_service.proto + +package verificationv1 + +import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + _ "github.com/authorizerdev/authorizer/gen/go/authorizer/common/v1" + v1 "github.com/authorizerdev/authorizer/gen/go/authorizer/session/v1" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 CreateOtpChallengeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Exactly one of email / phone_number is required. + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + PhoneNumber string `protobuf:"bytes,2,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` +} + +func (x *CreateOtpChallengeRequest) Reset() { + *x = CreateOtpChallengeRequest{} + mi := &file_authorizer_verification_v1_otp_challenge_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateOtpChallengeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateOtpChallengeRequest) ProtoMessage() {} + +func (x *CreateOtpChallengeRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_otp_challenge_service_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 CreateOtpChallengeRequest.ProtoReflect.Descriptor instead. +func (*CreateOtpChallengeRequest) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_otp_challenge_service_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateOtpChallengeRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *CreateOtpChallengeRequest) GetPhoneNumber() string { + if x != nil { + return x.PhoneNumber + } + return "" +} + +func (x *CreateOtpChallengeRequest) GetState() string { + if x != nil { + return x.State + } + return "" +} + +type CreateOtpChallengeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *CreateOtpChallengeResponse) Reset() { + *x = CreateOtpChallengeResponse{} + mi := &file_authorizer_verification_v1_otp_challenge_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateOtpChallengeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateOtpChallengeResponse) ProtoMessage() {} + +func (x *CreateOtpChallengeResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_otp_challenge_service_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 CreateOtpChallengeResponse.ProtoReflect.Descriptor instead. +func (*CreateOtpChallengeResponse) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_otp_challenge_service_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateOtpChallengeResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ConfirmOtpChallengeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Opaque challenge id (today: the email / phone the OTP was sent to). + ChallengeId string `protobuf:"bytes,1,opt,name=challenge_id,json=challengeId,proto3" json:"challenge_id,omitempty"` + // The OTP value the user entered. + Otp string `protobuf:"bytes,2,opt,name=otp,proto3" json:"otp,omitempty"` + // Either email or phone_number identifies the user (mirrors challenge_id + // for now; reserved for a future opaque challenge-id design). + Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` + PhoneNumber string `protobuf:"bytes,4,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` + IsTotp bool `protobuf:"varint,5,opt,name=is_totp,json=isTotp,proto3" json:"is_totp,omitempty"` + State string `protobuf:"bytes,6,opt,name=state,proto3" json:"state,omitempty"` +} + +func (x *ConfirmOtpChallengeRequest) Reset() { + *x = ConfirmOtpChallengeRequest{} + mi := &file_authorizer_verification_v1_otp_challenge_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfirmOtpChallengeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfirmOtpChallengeRequest) ProtoMessage() {} + +func (x *ConfirmOtpChallengeRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_otp_challenge_service_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 ConfirmOtpChallengeRequest.ProtoReflect.Descriptor instead. +func (*ConfirmOtpChallengeRequest) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_otp_challenge_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ConfirmOtpChallengeRequest) GetChallengeId() string { + if x != nil { + return x.ChallengeId + } + return "" +} + +func (x *ConfirmOtpChallengeRequest) GetOtp() string { + if x != nil { + return x.Otp + } + return "" +} + +func (x *ConfirmOtpChallengeRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *ConfirmOtpChallengeRequest) GetPhoneNumber() string { + if x != nil { + return x.PhoneNumber + } + return "" +} + +func (x *ConfirmOtpChallengeRequest) GetIsTotp() bool { + if x != nil { + return x.IsTotp + } + return false +} + +func (x *ConfirmOtpChallengeRequest) GetState() string { + if x != nil { + return x.State + } + return "" +} + +type ConfirmOtpChallengeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Session *v1.Session `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"` +} + +func (x *ConfirmOtpChallengeResponse) Reset() { + *x = ConfirmOtpChallengeResponse{} + mi := &file_authorizer_verification_v1_otp_challenge_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfirmOtpChallengeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfirmOtpChallengeResponse) ProtoMessage() {} + +func (x *ConfirmOtpChallengeResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_otp_challenge_service_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 ConfirmOtpChallengeResponse.ProtoReflect.Descriptor instead. +func (*ConfirmOtpChallengeResponse) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_otp_challenge_service_proto_rawDescGZIP(), []int{3} +} + +func (x *ConfirmOtpChallengeResponse) GetSession() *v1.Session { + if x != nil { + return x.Session + } + return nil +} + +var File_authorizer_verification_v1_otp_challenge_service_proto protoreflect.FileDescriptor + +var file_authorizer_verification_v1_otp_challenge_service_proto_rawDesc = []byte{ + 0x0a, 0x36, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x74, 0x70, + 0x5f, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 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, 0x74, 0x6f, 0x1a, + 0x26, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7d, 0x0a, 0x19, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x74, 0x70, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, + 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x05, 0x65, 0x6d, 0x61, + 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0x18, + 0xc0, 0x02, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x2a, 0x0a, 0x0c, 0x70, 0x68, 0x6f, + 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x18, 0x20, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x36, 0x0a, 0x1a, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x74, 0x70, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x22, 0xe0, 0x01, 0x0a, 0x1a, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x4f, + 0x74, 0x70, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x0b, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x49, 0x64, 0x12, 0x1b, + 0x0a, 0x03, 0x6f, 0x74, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, 0xba, 0x48, 0x06, + 0x72, 0x04, 0x10, 0x01, 0x18, 0x10, 0x52, 0x03, 0x6f, 0x74, 0x70, 0x12, 0x1e, 0x0a, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, + 0x03, 0x18, 0xc0, 0x02, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x2a, 0x0a, 0x0c, 0x70, + 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x18, 0x20, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, + 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x74, 0x6f, + 0x74, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x54, 0x6f, 0x74, 0x70, + 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x57, 0x0a, 0x1b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, + 0x6d, 0x4f, 0x74, 0x70, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x32, + 0xfd, 0x02, 0x0a, 0x13, 0x4f, 0x74, 0x70, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa6, 0x01, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4f, 0x74, 0x70, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x12, 0x35, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4f, 0x74, 0x70, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x74, 0x70, 0x43, 0x68, 0x61, 0x6c, + 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0xa0, + 0xb5, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x76, + 0x31, 0x2f, 0x6f, 0x74, 0x70, 0x2d, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x73, + 0x12, 0xbc, 0x01, 0x0a, 0x13, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x4f, 0x74, 0x70, 0x43, + 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x12, 0x36, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x4f, 0x74, 0x70, + 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x37, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x4f, 0x74, 0x70, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, 0x98, 0xb5, 0x18, 0x01, 0xa0, + 0xb5, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x3a, 0x01, 0x2a, 0x1a, 0x21, 0x2f, 0x76, + 0x31, 0x2f, 0x6f, 0x74, 0x70, 0x2d, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x73, + 0x2f, 0x7b, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x42, + 0x9a, 0x02, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x42, 0x18, 0x4f, 0x74, 0x70, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x54, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x72, 0x64, 0x65, 0x76, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x56, 0x58, 0xaa, 0x02, 0x1a, 0x41, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1a, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x5c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x26, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x72, 0x5c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, + 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, + 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x65, 0x72, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_authorizer_verification_v1_otp_challenge_service_proto_rawDescOnce sync.Once + file_authorizer_verification_v1_otp_challenge_service_proto_rawDescData = file_authorizer_verification_v1_otp_challenge_service_proto_rawDesc +) + +func file_authorizer_verification_v1_otp_challenge_service_proto_rawDescGZIP() []byte { + file_authorizer_verification_v1_otp_challenge_service_proto_rawDescOnce.Do(func() { + file_authorizer_verification_v1_otp_challenge_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authorizer_verification_v1_otp_challenge_service_proto_rawDescData) + }) + return file_authorizer_verification_v1_otp_challenge_service_proto_rawDescData +} + +var file_authorizer_verification_v1_otp_challenge_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_authorizer_verification_v1_otp_challenge_service_proto_goTypes = []any{ + (*CreateOtpChallengeRequest)(nil), // 0: authorizer.verification.v1.CreateOtpChallengeRequest + (*CreateOtpChallengeResponse)(nil), // 1: authorizer.verification.v1.CreateOtpChallengeResponse + (*ConfirmOtpChallengeRequest)(nil), // 2: authorizer.verification.v1.ConfirmOtpChallengeRequest + (*ConfirmOtpChallengeResponse)(nil), // 3: authorizer.verification.v1.ConfirmOtpChallengeResponse + (*v1.Session)(nil), // 4: authorizer.session.v1.Session +} +var file_authorizer_verification_v1_otp_challenge_service_proto_depIdxs = []int32{ + 4, // 0: authorizer.verification.v1.ConfirmOtpChallengeResponse.session:type_name -> authorizer.session.v1.Session + 0, // 1: authorizer.verification.v1.OtpChallengeService.CreateOtpChallenge:input_type -> authorizer.verification.v1.CreateOtpChallengeRequest + 2, // 2: authorizer.verification.v1.OtpChallengeService.ConfirmOtpChallenge:input_type -> authorizer.verification.v1.ConfirmOtpChallengeRequest + 1, // 3: authorizer.verification.v1.OtpChallengeService.CreateOtpChallenge:output_type -> authorizer.verification.v1.CreateOtpChallengeResponse + 3, // 4: authorizer.verification.v1.OtpChallengeService.ConfirmOtpChallenge:output_type -> authorizer.verification.v1.ConfirmOtpChallengeResponse + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] 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_authorizer_verification_v1_otp_challenge_service_proto_init() } +func file_authorizer_verification_v1_otp_challenge_service_proto_init() { + if File_authorizer_verification_v1_otp_challenge_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_authorizer_verification_v1_otp_challenge_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_authorizer_verification_v1_otp_challenge_service_proto_goTypes, + DependencyIndexes: file_authorizer_verification_v1_otp_challenge_service_proto_depIdxs, + MessageInfos: file_authorizer_verification_v1_otp_challenge_service_proto_msgTypes, + }.Build() + File_authorizer_verification_v1_otp_challenge_service_proto = out.File + file_authorizer_verification_v1_otp_challenge_service_proto_rawDesc = nil + file_authorizer_verification_v1_otp_challenge_service_proto_goTypes = nil + file_authorizer_verification_v1_otp_challenge_service_proto_depIdxs = nil +} diff --git a/gen/go/authorizer/verification/v1/otp_challenge_service.pb.gw.go b/gen/go/authorizer/verification/v1/otp_challenge_service.pb.gw.go new file mode 100644 index 00000000..0955a2c7 --- /dev/null +++ b/gen/go/authorizer/verification/v1/otp_challenge_service.pb.gw.go @@ -0,0 +1,275 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: authorizer/verification/v1/otp_challenge_service.proto + +/* +Package verificationv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package verificationv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_OtpChallengeService_CreateOtpChallenge_0(ctx context.Context, marshaler runtime.Marshaler, client OtpChallengeServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateOtpChallengeRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateOtpChallenge(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_OtpChallengeService_CreateOtpChallenge_0(ctx context.Context, marshaler runtime.Marshaler, server OtpChallengeServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateOtpChallengeRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateOtpChallenge(ctx, &protoReq) + return msg, metadata, err + +} + +func request_OtpChallengeService_ConfirmOtpChallenge_0(ctx context.Context, marshaler runtime.Marshaler, client OtpChallengeServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ConfirmOtpChallengeRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["challenge_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "challenge_id") + } + + protoReq.ChallengeId, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "challenge_id", err) + } + + msg, err := client.ConfirmOtpChallenge(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_OtpChallengeService_ConfirmOtpChallenge_0(ctx context.Context, marshaler runtime.Marshaler, server OtpChallengeServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ConfirmOtpChallengeRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["challenge_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "challenge_id") + } + + protoReq.ChallengeId, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "challenge_id", err) + } + + msg, err := server.ConfirmOtpChallenge(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterOtpChallengeServiceHandlerServer registers the http handlers for service OtpChallengeService to "mux". +// UnaryRPC :call OtpChallengeServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterOtpChallengeServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterOtpChallengeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OtpChallengeServiceServer) error { + + mux.Handle("POST", pattern_OtpChallengeService_CreateOtpChallenge_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, "/authorizer.verification.v1.OtpChallengeService/CreateOtpChallenge", runtime.WithHTTPPathPattern("/v1/otp-challenges")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_OtpChallengeService_CreateOtpChallenge_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_OtpChallengeService_CreateOtpChallenge_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_OtpChallengeService_ConfirmOtpChallenge_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, "/authorizer.verification.v1.OtpChallengeService/ConfirmOtpChallenge", runtime.WithHTTPPathPattern("/v1/otp-challenges/{challenge_id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_OtpChallengeService_ConfirmOtpChallenge_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_OtpChallengeService_ConfirmOtpChallenge_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterOtpChallengeServiceHandlerFromEndpoint is same as RegisterOtpChallengeServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterOtpChallengeServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterOtpChallengeServiceHandler(ctx, mux, conn) +} + +// RegisterOtpChallengeServiceHandler registers the http handlers for service OtpChallengeService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterOtpChallengeServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterOtpChallengeServiceHandlerClient(ctx, mux, NewOtpChallengeServiceClient(conn)) +} + +// RegisterOtpChallengeServiceHandlerClient registers the http handlers for service OtpChallengeService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "OtpChallengeServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "OtpChallengeServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "OtpChallengeServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterOtpChallengeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OtpChallengeServiceClient) error { + + mux.Handle("POST", pattern_OtpChallengeService_CreateOtpChallenge_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, "/authorizer.verification.v1.OtpChallengeService/CreateOtpChallenge", runtime.WithHTTPPathPattern("/v1/otp-challenges")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_OtpChallengeService_CreateOtpChallenge_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_OtpChallengeService_CreateOtpChallenge_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_OtpChallengeService_ConfirmOtpChallenge_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, "/authorizer.verification.v1.OtpChallengeService/ConfirmOtpChallenge", runtime.WithHTTPPathPattern("/v1/otp-challenges/{challenge_id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_OtpChallengeService_ConfirmOtpChallenge_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_OtpChallengeService_ConfirmOtpChallenge_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_OtpChallengeService_CreateOtpChallenge_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "otp-challenges"}, "")) + + pattern_OtpChallengeService_ConfirmOtpChallenge_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "otp-challenges", "challenge_id"}, "")) +) + +var ( + forward_OtpChallengeService_CreateOtpChallenge_0 = runtime.ForwardResponseMessage + + forward_OtpChallengeService_ConfirmOtpChallenge_0 = runtime.ForwardResponseMessage +) diff --git a/gen/go/authorizer/verification/v1/otp_challenge_service_grpc.pb.go b/gen/go/authorizer/verification/v1/otp_challenge_service_grpc.pb.go new file mode 100644 index 00000000..9625e103 --- /dev/null +++ b/gen/go/authorizer/verification/v1/otp_challenge_service_grpc.pb.go @@ -0,0 +1,175 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: authorizer/verification/v1/otp_challenge_service.proto + +package verificationv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + OtpChallengeService_CreateOtpChallenge_FullMethodName = "/authorizer.verification.v1.OtpChallengeService/CreateOtpChallenge" + OtpChallengeService_ConfirmOtpChallenge_FullMethodName = "/authorizer.verification.v1.OtpChallengeService/ConfirmOtpChallenge" +) + +// OtpChallengeServiceClient is the client API for OtpChallengeService service. +// +// 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. +// +// OtpChallengeService models the OTP step (email or SMS or TOTP) as a +// challenge resource. Create requests a fresh OTP; Confirm verifies it and +// — if successful — issues a Session (since OTP is the second factor of an +// in-progress login). +type OtpChallengeServiceClient interface { + // CreateOtpChallenge (re)sends an OTP to the address tied to an + // in-progress login. Returns 201. + CreateOtpChallenge(ctx context.Context, in *CreateOtpChallengeRequest, opts ...grpc.CallOption) (*CreateOtpChallengeResponse, error) + // ConfirmOtpChallenge verifies the supplied OTP and, on success, returns + // a Session for the user. Browser callers also receive Set-Cookie. + ConfirmOtpChallenge(ctx context.Context, in *ConfirmOtpChallengeRequest, opts ...grpc.CallOption) (*ConfirmOtpChallengeResponse, error) +} + +type otpChallengeServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewOtpChallengeServiceClient(cc grpc.ClientConnInterface) OtpChallengeServiceClient { + return &otpChallengeServiceClient{cc} +} + +func (c *otpChallengeServiceClient) CreateOtpChallenge(ctx context.Context, in *CreateOtpChallengeRequest, opts ...grpc.CallOption) (*CreateOtpChallengeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateOtpChallengeResponse) + err := c.cc.Invoke(ctx, OtpChallengeService_CreateOtpChallenge_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *otpChallengeServiceClient) ConfirmOtpChallenge(ctx context.Context, in *ConfirmOtpChallengeRequest, opts ...grpc.CallOption) (*ConfirmOtpChallengeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ConfirmOtpChallengeResponse) + err := c.cc.Invoke(ctx, OtpChallengeService_ConfirmOtpChallenge_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// OtpChallengeServiceServer is the server API for OtpChallengeService service. +// All implementations should embed UnimplementedOtpChallengeServiceServer +// for forward compatibility. +// +// OtpChallengeService models the OTP step (email or SMS or TOTP) as a +// challenge resource. Create requests a fresh OTP; Confirm verifies it and +// — if successful — issues a Session (since OTP is the second factor of an +// in-progress login). +type OtpChallengeServiceServer interface { + // CreateOtpChallenge (re)sends an OTP to the address tied to an + // in-progress login. Returns 201. + CreateOtpChallenge(context.Context, *CreateOtpChallengeRequest) (*CreateOtpChallengeResponse, error) + // ConfirmOtpChallenge verifies the supplied OTP and, on success, returns + // a Session for the user. Browser callers also receive Set-Cookie. + ConfirmOtpChallenge(context.Context, *ConfirmOtpChallengeRequest) (*ConfirmOtpChallengeResponse, error) +} + +// UnimplementedOtpChallengeServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedOtpChallengeServiceServer struct{} + +func (UnimplementedOtpChallengeServiceServer) CreateOtpChallenge(context.Context, *CreateOtpChallengeRequest) (*CreateOtpChallengeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateOtpChallenge not implemented") +} +func (UnimplementedOtpChallengeServiceServer) ConfirmOtpChallenge(context.Context, *ConfirmOtpChallengeRequest) (*ConfirmOtpChallengeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfirmOtpChallenge not implemented") +} +func (UnimplementedOtpChallengeServiceServer) testEmbeddedByValue() {} + +// UnsafeOtpChallengeServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to OtpChallengeServiceServer will +// result in compilation errors. +type UnsafeOtpChallengeServiceServer interface { + mustEmbedUnimplementedOtpChallengeServiceServer() +} + +func RegisterOtpChallengeServiceServer(s grpc.ServiceRegistrar, srv OtpChallengeServiceServer) { + // If the following call pancis, it indicates UnimplementedOtpChallengeServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&OtpChallengeService_ServiceDesc, srv) +} + +func _OtpChallengeService_CreateOtpChallenge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateOtpChallengeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OtpChallengeServiceServer).CreateOtpChallenge(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OtpChallengeService_CreateOtpChallenge_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OtpChallengeServiceServer).CreateOtpChallenge(ctx, req.(*CreateOtpChallengeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OtpChallengeService_ConfirmOtpChallenge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfirmOtpChallengeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OtpChallengeServiceServer).ConfirmOtpChallenge(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OtpChallengeService_ConfirmOtpChallenge_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OtpChallengeServiceServer).ConfirmOtpChallenge(ctx, req.(*ConfirmOtpChallengeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// OtpChallengeService_ServiceDesc is the grpc.ServiceDesc for OtpChallengeService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var OtpChallengeService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "authorizer.verification.v1.OtpChallengeService", + HandlerType: (*OtpChallengeServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateOtpChallenge", + Handler: _OtpChallengeService_CreateOtpChallenge_Handler, + }, + { + MethodName: "ConfirmOtpChallenge", + Handler: _OtpChallengeService_ConfirmOtpChallenge_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "authorizer/verification/v1/otp_challenge_service.proto", +} diff --git a/gen/go/authorizer/verification/v1/password_reset_service.pb.go b/gen/go/authorizer/verification/v1/password_reset_service.pb.go new file mode 100644 index 00000000..d6380214 --- /dev/null +++ b/gen/go/authorizer/verification/v1/password_reset_service.pb.go @@ -0,0 +1,415 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: authorizer/verification/v1/password_reset_service.proto + +package verificationv1 + +import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + _ "github.com/authorizerdev/authorizer/gen/go/authorizer/common/v1" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 CreatePasswordResetRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Exactly one of email / phone_number is required. + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + PhoneNumber string `protobuf:"bytes,2,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` + RedirectUri string `protobuf:"bytes,4,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"` +} + +func (x *CreatePasswordResetRequest) Reset() { + *x = CreatePasswordResetRequest{} + mi := &file_authorizer_verification_v1_password_reset_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreatePasswordResetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePasswordResetRequest) ProtoMessage() {} + +func (x *CreatePasswordResetRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_password_reset_service_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 CreatePasswordResetRequest.ProtoReflect.Descriptor instead. +func (*CreatePasswordResetRequest) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_password_reset_service_proto_rawDescGZIP(), []int{0} +} + +func (x *CreatePasswordResetRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *CreatePasswordResetRequest) GetPhoneNumber() string { + if x != nil { + return x.PhoneNumber + } + return "" +} + +func (x *CreatePasswordResetRequest) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *CreatePasswordResetRequest) GetRedirectUri() string { + if x != nil { + return x.RedirectUri + } + return "" +} + +type CreatePasswordResetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + // Mobile callers may need to render an OTP entry screen (when reset is + // SMS-driven). Mirrors GraphQL ForgotPasswordResponse. + ShouldShowMobileOtpScreen bool `protobuf:"varint,2,opt,name=should_show_mobile_otp_screen,json=shouldShowMobileOtpScreen,proto3" json:"should_show_mobile_otp_screen,omitempty"` +} + +func (x *CreatePasswordResetResponse) Reset() { + *x = CreatePasswordResetResponse{} + mi := &file_authorizer_verification_v1_password_reset_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreatePasswordResetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePasswordResetResponse) ProtoMessage() {} + +func (x *CreatePasswordResetResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_password_reset_service_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 CreatePasswordResetResponse.ProtoReflect.Descriptor instead. +func (*CreatePasswordResetResponse) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_password_reset_service_proto_rawDescGZIP(), []int{1} +} + +func (x *CreatePasswordResetResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *CreatePasswordResetResponse) GetShouldShowMobileOtpScreen() bool { + if x != nil { + return x.ShouldShowMobileOtpScreen + } + return false +} + +type ConfirmPasswordResetRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The token from the reset email/SMS; for SMS flows it's the OTP value. + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + // For SMS flows: the user identifier the OTP was bound to. + PhoneNumber string `protobuf:"bytes,2,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"` + Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` + ConfirmPassword string `protobuf:"bytes,4,opt,name=confirm_password,json=confirmPassword,proto3" json:"confirm_password,omitempty"` +} + +func (x *ConfirmPasswordResetRequest) Reset() { + *x = ConfirmPasswordResetRequest{} + mi := &file_authorizer_verification_v1_password_reset_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfirmPasswordResetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfirmPasswordResetRequest) ProtoMessage() {} + +func (x *ConfirmPasswordResetRequest) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_password_reset_service_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 ConfirmPasswordResetRequest.ProtoReflect.Descriptor instead. +func (*ConfirmPasswordResetRequest) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_password_reset_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ConfirmPasswordResetRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *ConfirmPasswordResetRequest) GetPhoneNumber() string { + if x != nil { + return x.PhoneNumber + } + return "" +} + +func (x *ConfirmPasswordResetRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *ConfirmPasswordResetRequest) GetConfirmPassword() string { + if x != nil { + return x.ConfirmPassword + } + return "" +} + +type ConfirmPasswordResetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *ConfirmPasswordResetResponse) Reset() { + *x = ConfirmPasswordResetResponse{} + mi := &file_authorizer_verification_v1_password_reset_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfirmPasswordResetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfirmPasswordResetResponse) ProtoMessage() {} + +func (x *ConfirmPasswordResetResponse) ProtoReflect() protoreflect.Message { + mi := &file_authorizer_verification_v1_password_reset_service_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 ConfirmPasswordResetResponse.ProtoReflect.Descriptor instead. +func (*ConfirmPasswordResetResponse) Descriptor() ([]byte, []int) { + return file_authorizer_verification_v1_password_reset_service_proto_rawDescGZIP(), []int{3} +} + +func (x *ConfirmPasswordResetResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +var File_authorizer_verification_v1_password_reset_service_proto protoreflect.FileDescriptor + +var file_authorizer_verification_v1_password_reset_service_proto_rawDesc = []byte{ + 0x0a, 0x37, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 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, 0x74, 0x6f, + 0x1a, 0x26, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa1, 0x01, 0x0a, 0x1a, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0x18, 0xc0, 0x02, + 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x2a, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, + 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, + 0x48, 0x04, 0x72, 0x02, 0x18, 0x20, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x64, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x55, 0x72, 0x69, 0x22, 0x79, 0x0a, 0x1b, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, + 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x40, 0x0a, 0x1d, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x5f, + 0x73, 0x68, 0x6f, 0x77, 0x5f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x5f, 0x6f, 0x74, 0x70, 0x5f, + 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x19, 0x73, 0x68, + 0x6f, 0x75, 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x77, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x4f, 0x74, + 0x70, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x22, 0xc7, 0x01, 0x0a, 0x1b, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x72, 0x6d, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, + 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, + 0x04, 0x72, 0x02, 0x18, 0x20, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x26, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0x80, 0x01, + 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x35, 0x0a, 0x10, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0x80, 0x01, + 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x22, 0x38, 0x0a, 0x1c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0xff, 0x02, 0x0a, 0x14, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0xaa, 0x01, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x12, 0x36, 0x2e, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0xa0, + 0xb5, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x3a, 0x01, 0x2a, 0x22, 0x13, 0x2f, 0x76, + 0x31, 0x2f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x2d, 0x72, 0x65, 0x73, 0x65, 0x74, + 0x73, 0x12, 0xb9, 0x01, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x12, 0x37, 0x2e, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x98, + 0xb5, 0x18, 0x01, 0xa0, 0xb5, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, + 0x1a, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x2d, 0x72, + 0x65, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x7d, 0x42, 0x9b, 0x02, + 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, + 0x42, 0x19, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x54, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x64, 0x65, 0x76, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x72, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x56, 0x58, 0xaa, 0x02, 0x1a, 0x41, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1a, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x5c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x26, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x5c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_authorizer_verification_v1_password_reset_service_proto_rawDescOnce sync.Once + file_authorizer_verification_v1_password_reset_service_proto_rawDescData = file_authorizer_verification_v1_password_reset_service_proto_rawDesc +) + +func file_authorizer_verification_v1_password_reset_service_proto_rawDescGZIP() []byte { + file_authorizer_verification_v1_password_reset_service_proto_rawDescOnce.Do(func() { + file_authorizer_verification_v1_password_reset_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authorizer_verification_v1_password_reset_service_proto_rawDescData) + }) + return file_authorizer_verification_v1_password_reset_service_proto_rawDescData +} + +var file_authorizer_verification_v1_password_reset_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_authorizer_verification_v1_password_reset_service_proto_goTypes = []any{ + (*CreatePasswordResetRequest)(nil), // 0: authorizer.verification.v1.CreatePasswordResetRequest + (*CreatePasswordResetResponse)(nil), // 1: authorizer.verification.v1.CreatePasswordResetResponse + (*ConfirmPasswordResetRequest)(nil), // 2: authorizer.verification.v1.ConfirmPasswordResetRequest + (*ConfirmPasswordResetResponse)(nil), // 3: authorizer.verification.v1.ConfirmPasswordResetResponse +} +var file_authorizer_verification_v1_password_reset_service_proto_depIdxs = []int32{ + 0, // 0: authorizer.verification.v1.PasswordResetService.CreatePasswordReset:input_type -> authorizer.verification.v1.CreatePasswordResetRequest + 2, // 1: authorizer.verification.v1.PasswordResetService.ConfirmPasswordReset:input_type -> authorizer.verification.v1.ConfirmPasswordResetRequest + 1, // 2: authorizer.verification.v1.PasswordResetService.CreatePasswordReset:output_type -> authorizer.verification.v1.CreatePasswordResetResponse + 3, // 3: authorizer.verification.v1.PasswordResetService.ConfirmPasswordReset:output_type -> authorizer.verification.v1.ConfirmPasswordResetResponse + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_authorizer_verification_v1_password_reset_service_proto_init() } +func file_authorizer_verification_v1_password_reset_service_proto_init() { + if File_authorizer_verification_v1_password_reset_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_authorizer_verification_v1_password_reset_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_authorizer_verification_v1_password_reset_service_proto_goTypes, + DependencyIndexes: file_authorizer_verification_v1_password_reset_service_proto_depIdxs, + MessageInfos: file_authorizer_verification_v1_password_reset_service_proto_msgTypes, + }.Build() + File_authorizer_verification_v1_password_reset_service_proto = out.File + file_authorizer_verification_v1_password_reset_service_proto_rawDesc = nil + file_authorizer_verification_v1_password_reset_service_proto_goTypes = nil + file_authorizer_verification_v1_password_reset_service_proto_depIdxs = nil +} diff --git a/gen/go/authorizer/verification/v1/password_reset_service.pb.gw.go b/gen/go/authorizer/verification/v1/password_reset_service.pb.gw.go new file mode 100644 index 00000000..97462402 --- /dev/null +++ b/gen/go/authorizer/verification/v1/password_reset_service.pb.gw.go @@ -0,0 +1,275 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: authorizer/verification/v1/password_reset_service.proto + +/* +Package verificationv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package verificationv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_PasswordResetService_CreatePasswordReset_0(ctx context.Context, marshaler runtime.Marshaler, client PasswordResetServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreatePasswordResetRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreatePasswordReset(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_PasswordResetService_CreatePasswordReset_0(ctx context.Context, marshaler runtime.Marshaler, server PasswordResetServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreatePasswordResetRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreatePasswordReset(ctx, &protoReq) + return msg, metadata, err + +} + +func request_PasswordResetService_ConfirmPasswordReset_0(ctx context.Context, marshaler runtime.Marshaler, client PasswordResetServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ConfirmPasswordResetRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["token"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "token") + } + + protoReq.Token, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "token", err) + } + + msg, err := client.ConfirmPasswordReset(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_PasswordResetService_ConfirmPasswordReset_0(ctx context.Context, marshaler runtime.Marshaler, server PasswordResetServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ConfirmPasswordResetRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["token"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "token") + } + + protoReq.Token, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "token", err) + } + + msg, err := server.ConfirmPasswordReset(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterPasswordResetServiceHandlerServer registers the http handlers for service PasswordResetService to "mux". +// UnaryRPC :call PasswordResetServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPasswordResetServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterPasswordResetServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PasswordResetServiceServer) error { + + mux.Handle("POST", pattern_PasswordResetService_CreatePasswordReset_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, "/authorizer.verification.v1.PasswordResetService/CreatePasswordReset", runtime.WithHTTPPathPattern("/v1/password-resets")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_PasswordResetService_CreatePasswordReset_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_PasswordResetService_CreatePasswordReset_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_PasswordResetService_ConfirmPasswordReset_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, "/authorizer.verification.v1.PasswordResetService/ConfirmPasswordReset", runtime.WithHTTPPathPattern("/v1/password-resets/{token}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_PasswordResetService_ConfirmPasswordReset_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_PasswordResetService_ConfirmPasswordReset_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterPasswordResetServiceHandlerFromEndpoint is same as RegisterPasswordResetServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterPasswordResetServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterPasswordResetServiceHandler(ctx, mux, conn) +} + +// RegisterPasswordResetServiceHandler registers the http handlers for service PasswordResetService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterPasswordResetServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterPasswordResetServiceHandlerClient(ctx, mux, NewPasswordResetServiceClient(conn)) +} + +// RegisterPasswordResetServiceHandlerClient registers the http handlers for service PasswordResetService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PasswordResetServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PasswordResetServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "PasswordResetServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterPasswordResetServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PasswordResetServiceClient) error { + + mux.Handle("POST", pattern_PasswordResetService_CreatePasswordReset_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, "/authorizer.verification.v1.PasswordResetService/CreatePasswordReset", runtime.WithHTTPPathPattern("/v1/password-resets")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_PasswordResetService_CreatePasswordReset_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_PasswordResetService_CreatePasswordReset_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_PasswordResetService_ConfirmPasswordReset_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, "/authorizer.verification.v1.PasswordResetService/ConfirmPasswordReset", runtime.WithHTTPPathPattern("/v1/password-resets/{token}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_PasswordResetService_ConfirmPasswordReset_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_PasswordResetService_ConfirmPasswordReset_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_PasswordResetService_CreatePasswordReset_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "password-resets"}, "")) + + pattern_PasswordResetService_ConfirmPasswordReset_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "password-resets", "token"}, "")) +) + +var ( + forward_PasswordResetService_CreatePasswordReset_0 = runtime.ForwardResponseMessage + + forward_PasswordResetService_ConfirmPasswordReset_0 = runtime.ForwardResponseMessage +) diff --git a/gen/go/authorizer/verification/v1/password_reset_service_grpc.pb.go b/gen/go/authorizer/verification/v1/password_reset_service_grpc.pb.go new file mode 100644 index 00000000..181f2509 --- /dev/null +++ b/gen/go/authorizer/verification/v1/password_reset_service_grpc.pb.go @@ -0,0 +1,175 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: authorizer/verification/v1/password_reset_service.proto + +package verificationv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + PasswordResetService_CreatePasswordReset_FullMethodName = "/authorizer.verification.v1.PasswordResetService/CreatePasswordReset" + PasswordResetService_ConfirmPasswordReset_FullMethodName = "/authorizer.verification.v1.PasswordResetService/ConfirmPasswordReset" +) + +// PasswordResetServiceClient is the client API for PasswordResetService service. +// +// 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. +// +// PasswordResetService models the forgot-password flow as a challenge +// resource: Create dispatches an email/SMS with a reset link; Confirm +// applies the new password using the link's token. +type PasswordResetServiceClient interface { + // CreatePasswordReset dispatches a reset notification. Returns 202. + // Always returns success even when the address is unknown (prevents + // account enumeration). + CreatePasswordReset(ctx context.Context, in *CreatePasswordResetRequest, opts ...grpc.CallOption) (*CreatePasswordResetResponse, error) + // ConfirmPasswordReset sets the user's new password using the token from + // the reset notification. + ConfirmPasswordReset(ctx context.Context, in *ConfirmPasswordResetRequest, opts ...grpc.CallOption) (*ConfirmPasswordResetResponse, error) +} + +type passwordResetServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPasswordResetServiceClient(cc grpc.ClientConnInterface) PasswordResetServiceClient { + return &passwordResetServiceClient{cc} +} + +func (c *passwordResetServiceClient) CreatePasswordReset(ctx context.Context, in *CreatePasswordResetRequest, opts ...grpc.CallOption) (*CreatePasswordResetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreatePasswordResetResponse) + err := c.cc.Invoke(ctx, PasswordResetService_CreatePasswordReset_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *passwordResetServiceClient) ConfirmPasswordReset(ctx context.Context, in *ConfirmPasswordResetRequest, opts ...grpc.CallOption) (*ConfirmPasswordResetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ConfirmPasswordResetResponse) + err := c.cc.Invoke(ctx, PasswordResetService_ConfirmPasswordReset_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PasswordResetServiceServer is the server API for PasswordResetService service. +// All implementations should embed UnimplementedPasswordResetServiceServer +// for forward compatibility. +// +// PasswordResetService models the forgot-password flow as a challenge +// resource: Create dispatches an email/SMS with a reset link; Confirm +// applies the new password using the link's token. +type PasswordResetServiceServer interface { + // CreatePasswordReset dispatches a reset notification. Returns 202. + // Always returns success even when the address is unknown (prevents + // account enumeration). + CreatePasswordReset(context.Context, *CreatePasswordResetRequest) (*CreatePasswordResetResponse, error) + // ConfirmPasswordReset sets the user's new password using the token from + // the reset notification. + ConfirmPasswordReset(context.Context, *ConfirmPasswordResetRequest) (*ConfirmPasswordResetResponse, error) +} + +// UnimplementedPasswordResetServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedPasswordResetServiceServer struct{} + +func (UnimplementedPasswordResetServiceServer) CreatePasswordReset(context.Context, *CreatePasswordResetRequest) (*CreatePasswordResetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreatePasswordReset not implemented") +} +func (UnimplementedPasswordResetServiceServer) ConfirmPasswordReset(context.Context, *ConfirmPasswordResetRequest) (*ConfirmPasswordResetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfirmPasswordReset not implemented") +} +func (UnimplementedPasswordResetServiceServer) testEmbeddedByValue() {} + +// UnsafePasswordResetServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PasswordResetServiceServer will +// result in compilation errors. +type UnsafePasswordResetServiceServer interface { + mustEmbedUnimplementedPasswordResetServiceServer() +} + +func RegisterPasswordResetServiceServer(s grpc.ServiceRegistrar, srv PasswordResetServiceServer) { + // If the following call pancis, it indicates UnimplementedPasswordResetServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&PasswordResetService_ServiceDesc, srv) +} + +func _PasswordResetService_CreatePasswordReset_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePasswordResetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PasswordResetServiceServer).CreatePasswordReset(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PasswordResetService_CreatePasswordReset_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PasswordResetServiceServer).CreatePasswordReset(ctx, req.(*CreatePasswordResetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PasswordResetService_ConfirmPasswordReset_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfirmPasswordResetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PasswordResetServiceServer).ConfirmPasswordReset(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PasswordResetService_ConfirmPasswordReset_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PasswordResetServiceServer).ConfirmPasswordReset(ctx, req.(*ConfirmPasswordResetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// PasswordResetService_ServiceDesc is the grpc.ServiceDesc for PasswordResetService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PasswordResetService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "authorizer.verification.v1.PasswordResetService", + HandlerType: (*PasswordResetServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreatePasswordReset", + Handler: _PasswordResetService_CreatePasswordReset_Handler, + }, + { + MethodName: "ConfirmPasswordReset", + Handler: _PasswordResetService_ConfirmPasswordReset_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "authorizer/verification/v1/password_reset_service.proto", +} diff --git a/gen/openapi/authorizer.swagger.json b/gen/openapi/authorizer.swagger.json new file mode 100644 index 00000000..ac1e4edd --- /dev/null +++ b/gen/openapi/authorizer.swagger.json @@ -0,0 +1,1448 @@ +{ + "swagger": "2.0", + "info": { + "title": "authorizer/common/v1/annotations.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "AuthzService" + }, + { + "name": "MetaService" + }, + { + "name": "MagicLinkService" + }, + { + "name": "SessionService" + }, + { + "name": "TokenService" + }, + { + "name": "UserService" + }, + { + "name": "EmailVerificationService" + }, + { + "name": "OtpChallengeService" + }, + { + "name": "PasswordResetService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/email-verifications": { + "post": { + "summary": "CreateEmailVerification (re)sends the verification email for an\nunverified address. Returns 201; idempotent within a short window.", + "operationId": "EmailVerificationService_CreateEmailVerification", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreateEmailVerificationResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CreateEmailVerificationRequest" + } + } + ], + "tags": [ + "EmailVerificationService" + ] + } + }, + "/v1/email-verifications/{token}": { + "put": { + "summary": "ConfirmEmailVerification marks the verification complete. Returns a\nSession when the original signup was a self-sign-up flow (so the user\nis logged in immediately); otherwise returns the empty Session.", + "operationId": "EmailVerificationService_ConfirmEmailVerification", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ConfirmEmailVerificationResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "token", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/EmailVerificationServiceConfirmEmailVerificationBody" + } + } + ], + "tags": [ + "EmailVerificationService" + ] + } + }, + "/v1/magic-links": { + "post": { + "summary": "CreateMagicLink dispatches a magic-link email. Returns 202: the email\nis sent asynchronously; the link itself drives session creation later.", + "operationId": "MagicLinkService_CreateMagicLink", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreateMagicLinkResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CreateMagicLinkRequest" + } + } + ], + "tags": [ + "MagicLinkService" + ] + } + }, + "/v1/meta": { + "get": { + "summary": "GetMeta returns the server's feature-flag and provider configuration.\nUsed by SPAs to decide which login UIs to render.", + "operationId": "MetaService_GetMeta", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetMetaResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "MetaService" + ] + } + }, + "/v1/otp-challenges": { + "post": { + "summary": "CreateOtpChallenge (re)sends an OTP to the address tied to an\nin-progress login. Returns 201.", + "operationId": "OtpChallengeService_CreateOtpChallenge", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreateOtpChallengeResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CreateOtpChallengeRequest" + } + } + ], + "tags": [ + "OtpChallengeService" + ] + } + }, + "/v1/otp-challenges/{challenge_id}": { + "put": { + "summary": "ConfirmOtpChallenge verifies the supplied OTP and, on success, returns\na Session for the user. Browser callers also receive Set-Cookie.", + "operationId": "OtpChallengeService_ConfirmOtpChallenge", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ConfirmOtpChallengeResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "challenge_id", + "description": "Opaque challenge id (today: the email / phone the OTP was sent to).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/OtpChallengeServiceConfirmOtpChallengeBody" + } + } + ], + "tags": [ + "OtpChallengeService" + ] + } + }, + "/v1/password-resets": { + "post": { + "summary": "CreatePasswordReset dispatches a reset notification. Returns 202.\nAlways returns success even when the address is unknown (prevents\naccount enumeration).", + "operationId": "PasswordResetService_CreatePasswordReset", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreatePasswordResetResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CreatePasswordResetRequest" + } + } + ], + "tags": [ + "PasswordResetService" + ] + } + }, + "/v1/password-resets/{token}": { + "put": { + "summary": "ConfirmPasswordReset sets the user's new password using the token from\nthe reset notification.", + "operationId": "PasswordResetService_ConfirmPasswordReset", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ConfirmPasswordResetResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "token", + "description": "The token from the reset email/SMS; for SMS flows it's the OTP value.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PasswordResetServiceConfirmPasswordResetBody" + } + } + ], + "tags": [ + "PasswordResetService" + ] + } + }, + "/v1/refresh-tokens/{refresh_token}": { + "delete": { + "summary": "RevokeRefreshToken invalidates a refresh token. Typed mirror of\nRFC 7009 `POST /oauth/revoke`.", + "operationId": "TokenService_RevokeRefreshToken", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1RevokeRefreshTokenResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "refresh_token", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "TokenService" + ] + } + }, + "/v1/sessions": { + "post": { + "summary": "CreateSession authenticates a user and returns a new Session. The\nrequest carries exactly one credential type via `oneof grant`. Browser\ncallers (REST) additionally receive Set-Cookie headers. The OAuth2\ntoken endpoint at POST /oauth/token remains the spec-compliant\nalternative for OAuth clients.", + "operationId": "SessionService_CreateSession", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreateSessionResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CreateSessionRequest" + } + } + ], + "tags": [ + "SessionService" + ] + } + }, + "/v1/sessions/me": { + "get": { + "summary": "GetCurrentSession returns the session bound to the caller's cookie or\nbearer token. Returns NOT_FOUND when unauthenticated.", + "operationId": "SessionService_GetCurrentSession", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetCurrentSessionResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "roles", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "scope", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "state", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "SessionService" + ] + }, + "delete": { + "summary": "DeleteSession ends the caller's current session. Always returns empty\non success, even if no session was active (idempotent).", + "operationId": "SessionService_DeleteSession", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1DeleteSessionResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "SessionService" + ] + } + }, + "/v1/sessions/validations": { + "post": { + "summary": "CreateSessionValidation validates a cookie/token held by a third party\n— the typed equivalent of \"is this session real?\" used by backend\nservices validating tokens forwarded by an upstream proxy.", + "operationId": "SessionService_CreateSessionValidation", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreateSessionValidationResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CreateSessionValidationRequest" + } + } + ], + "tags": [ + "SessionService" + ] + } + }, + "/v1/token-validations": { + "post": { + "summary": "CreateTokenValidation validates a JWT and returns its claims. Equivalent\nto GraphQL validate_jwt_token.", + "operationId": "TokenService_CreateTokenValidation", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreateTokenValidationResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CreateTokenValidationRequest" + } + } + ], + "tags": [ + "TokenService" + ] + } + }, + "/v1/users": { + "post": { + "summary": "CreateUser registers a new user account. Public — requires sign-up\nenabled in server config. On success returns tokens and (for browser\ncallers) Set-Cookie headers.", + "operationId": "UserService_CreateUser", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreateUserResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CreateUserRequest" + } + } + ], + "tags": [ + "UserService" + ] + } + }, + "/v1/users/me": { + "get": { + "summary": "GetUser returns a single user. On this surface, only name=\"users/me\" is\naccepted; admin reads remain on GraphQL.", + "operationId": "UserService_GetUser", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetUserResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "name", + "description": "Must be \"users/me\" on this v1 surface.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "UserService" + ] + }, + "delete": { + "summary": "DeleteUser deactivates the caller's account (soft delete). All of the\nuser's refresh tokens are revoked as a side effect. OAuth has no\nstandard concept of account deactivation — this method is the typed\nequivalent of SCIM `PATCH /Users/{id} {active:false}`.", + "operationId": "UserService_DeleteUser", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1DeleteUserResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "name", + "description": "Must be \"users/me\" on this v1 surface.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "UserService" + ] + }, + "patch": { + "summary": "UpdateUser patches a user. On this surface, only name=\"users/me\" is\naccepted. The optional field_mask controls which fields are updated.", + "operationId": "UserService_UpdateUser", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1UpdateUserResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "user", + "description": "The user to update. user.id should be \"users/me\" or omitted.", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1User" + } + }, + { + "name": "old_password", + "description": "Optional credential change. Validated cross-field by the handler.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "new_password", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "confirm_new_password", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "UserService" + ] + } + }, + "/v1/users/me/permissions": { + "get": { + "summary": "ListMyPermissions returns every (resource, scope) pair the caller is\nallowed to act on, derived from their roles and the policy engine.", + "operationId": "AuthzService_ListMyPermissions", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ListMyPermissionsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "AuthzService" + ] + } + } + }, + "definitions": { + "EmailVerificationServiceConfirmEmailVerificationBody": { + "type": "object", + "properties": { + "state": { + "type": "string" + } + } + }, + "OtpChallengeServiceConfirmOtpChallengeBody": { + "type": "object", + "properties": { + "otp": { + "type": "string", + "description": "The OTP value the user entered." + }, + "email": { + "type": "string", + "description": "Either email or phone_number identifies the user (mirrors challenge_id\nfor now; reserved for a future opaque challenge-id design)." + }, + "phone_number": { + "type": "string" + }, + "is_totp": { + "type": "boolean" + }, + "state": { + "type": "string" + } + } + }, + "PasswordResetServiceConfirmPasswordResetBody": { + "type": "object", + "properties": { + "phone_number": { + "type": "string", + "description": "For SMS flows: the user identifier the OTP was bound to." + }, + "password": { + "type": "string" + }, + "confirm_password": { + "type": "string" + } + } + }, + "authorizersessionv1PermissionRef": { + "type": "object", + "properties": { + "resource": { + "type": "string" + }, + "scope": { + "type": "string" + } + } + }, + "authorizertokenv1PermissionRef": { + "type": "object", + "properties": { + "resource": { + "type": "string" + }, + "scope": { + "type": "string" + } + } + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "protobufNullValue": { + "type": "string", + "enum": [ + "NULL_VALUE" + ], + "default": "NULL_VALUE", + "description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\nThe JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value." + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1AppData": { + "type": "object", + "properties": { + "value": { + "type": "object" + } + }, + "description": "AppData is a free-form key/value bag stored against a user. Mirrors the\nGraphQL `Map` scalar. Values are JSON-typed (string, number, bool, null,\nnested object, nested array) to match what the existing storage layer\naccepts." + }, + "v1ConfirmEmailVerificationResponse": { + "type": "object", + "properties": { + "session": { + "$ref": "#/definitions/v1Session" + } + } + }, + "v1ConfirmOtpChallengeResponse": { + "type": "object", + "properties": { + "session": { + "$ref": "#/definitions/v1Session" + } + } + }, + "v1ConfirmPasswordResetResponse": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "v1CreateEmailVerificationRequest": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "identifier": { + "type": "string", + "description": "Verification identifier (typeof verification, e.g. basic-auth-signup)." + }, + "state": { + "type": "string" + } + } + }, + "v1CreateEmailVerificationResponse": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "v1CreateMagicLinkRequest": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "scope": { + "type": "array", + "items": { + "type": "string" + } + }, + "state": { + "type": "string" + }, + "redirect_uri": { + "type": "string" + } + } + }, + "v1CreateMagicLinkResponse": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "v1CreateOtpChallengeRequest": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "Exactly one of email / phone_number is required." + }, + "phone_number": { + "type": "string" + }, + "state": { + "type": "string" + } + } + }, + "v1CreateOtpChallengeResponse": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "v1CreatePasswordResetRequest": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "Exactly one of email / phone_number is required." + }, + "phone_number": { + "type": "string" + }, + "state": { + "type": "string" + }, + "redirect_uri": { + "type": "string" + } + } + }, + "v1CreatePasswordResetResponse": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "should_show_mobile_otp_screen": { + "type": "boolean", + "description": "Mobile callers may need to render an OTP entry screen (when reset is\nSMS-driven). Mirrors GraphQL ForgotPasswordResponse." + } + } + }, + "v1CreateSessionRequest": { + "type": "object", + "properties": { + "password": { + "$ref": "#/definitions/v1PasswordGrant" + }, + "otp": { + "$ref": "#/definitions/v1OtpGrant" + }, + "magic_link": { + "$ref": "#/definitions/v1MagicLinkGrant" + }, + "refresh_token": { + "$ref": "#/definitions/v1RefreshTokenGrant" + }, + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "scope": { + "type": "array", + "items": { + "type": "string" + } + }, + "state": { + "type": "string", + "description": "OAuth2 authorization-code flow state echoed back via c_hash." + } + } + }, + "v1CreateSessionResponse": { + "type": "object", + "properties": { + "session": { + "$ref": "#/definitions/v1Session" + } + } + }, + "v1CreateSessionValidationRequest": { + "type": "object", + "properties": { + "cookie": { + "type": "string", + "description": "Cookie value (typically the fingerprint hash) to validate." + }, + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "required_permissions": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/authorizersessionv1PermissionRef" + } + } + } + }, + "v1CreateSessionValidationResponse": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/v1SessionValidationResult" + } + } + }, + "v1CreateTokenValidationRequest": { + "type": "object", + "properties": { + "token_type": { + "type": "string", + "description": "One of: \"access_token\", \"id_token\", \"refresh_token\"." + }, + "token": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "required_permissions": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/authorizertokenv1PermissionRef" + } + } + } + }, + "v1CreateTokenValidationResponse": { + "type": "object", + "properties": { + "is_valid": { + "type": "boolean" + }, + "claims": { + "type": "object", + "description": "Free-form JWT claims; matches GraphQL ValidateJWTTokenResponse.claims." + } + } + }, + "v1CreateUserRequest": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "Email or phone_number must be set (validated at the handler)." + }, + "phone_number": { + "type": "string" + }, + "password": { + "type": "string" + }, + "confirm_password": { + "type": "string" + }, + "given_name": { + "type": "string" + }, + "family_name": { + "type": "string" + }, + "middle_name": { + "type": "string" + }, + "nickname": { + "type": "string" + }, + "gender": { + "type": "string" + }, + "birthdate": { + "type": "string" + }, + "picture": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "scope": { + "type": "array", + "items": { + "type": "string" + } + }, + "redirect_uri": { + "type": "string" + }, + "is_multi_factor_auth_enabled": { + "type": "boolean" + }, + "state": { + "type": "string", + "description": "OAuth2 authorization-code flow state echoed back via c_hash." + }, + "app_data": { + "$ref": "#/definitions/v1AppData" + } + } + }, + "v1CreateUserResponse": { + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "Human-readable message describing the outcome (e.g. \"Verification email\nsent\" vs \"Signed up successfully\")." + }, + "should_show_email_otp_screen": { + "type": "boolean" + }, + "should_show_mobile_otp_screen": { + "type": "boolean" + }, + "should_show_totp_screen": { + "type": "boolean" + }, + "access_token": { + "type": "string" + }, + "id_token": { + "type": "string" + }, + "refresh_token": { + "type": "string" + }, + "expires_in": { + "type": "string", + "format": "int64" + }, + "user": { + "$ref": "#/definitions/v1User" + } + } + }, + "v1DeleteSessionResponse": { + "type": "object" + }, + "v1DeleteUserResponse": { + "type": "object" + }, + "v1GetCurrentSessionResponse": { + "type": "object", + "properties": { + "session": { + "$ref": "#/definitions/v1Session" + } + } + }, + "v1GetMetaResponse": { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "client_id": { + "type": "string" + }, + "is_google_login_enabled": { + "type": "boolean" + }, + "is_facebook_login_enabled": { + "type": "boolean" + }, + "is_github_login_enabled": { + "type": "boolean" + }, + "is_linkedin_login_enabled": { + "type": "boolean" + }, + "is_apple_login_enabled": { + "type": "boolean" + }, + "is_discord_login_enabled": { + "type": "boolean" + }, + "is_twitter_login_enabled": { + "type": "boolean" + }, + "is_microsoft_login_enabled": { + "type": "boolean" + }, + "is_twitch_login_enabled": { + "type": "boolean" + }, + "is_roblox_login_enabled": { + "type": "boolean" + }, + "is_email_verification_enabled": { + "type": "boolean" + }, + "is_basic_authentication_enabled": { + "type": "boolean" + }, + "is_magic_link_login_enabled": { + "type": "boolean" + }, + "is_sign_up_enabled": { + "type": "boolean" + }, + "is_strong_password_enabled": { + "type": "boolean" + }, + "is_multi_factor_auth_enabled": { + "type": "boolean" + }, + "is_mobile_basic_authentication_enabled": { + "type": "boolean" + }, + "is_phone_verification_enabled": { + "type": "boolean" + } + }, + "description": "GetMetaResponse mirrors the GraphQL Meta type 1:1. Field naming uses the\nexisting snake_case names so existing consumers see the same shape over\nREST." + }, + "v1GetUserResponse": { + "type": "object", + "properties": { + "user": { + "$ref": "#/definitions/v1User" + } + } + }, + "v1ListMyPermissionsResponse": { + "type": "object", + "properties": { + "permissions": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1Permission" + } + } + } + }, + "v1MagicLinkGrant": { + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "The token from the magic-link email URL." + } + } + }, + "v1OtpGrant": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "phone_number": { + "type": "string" + }, + "otp": { + "type": "string" + }, + "is_totp": { + "type": "boolean" + } + } + }, + "v1PasswordGrant": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "Exactly one of email / phone_number is required." + }, + "phone_number": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "v1Permission": { + "type": "object", + "properties": { + "resource": { + "type": "string" + }, + "scope": { + "type": "string" + } + } + }, + "v1RefreshTokenGrant": { + "type": "object", + "properties": { + "refresh_token": { + "type": "string" + } + } + }, + "v1RevokeRefreshTokenResponse": { + "type": "object" + }, + "v1Session": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "should_show_email_otp_screen": { + "type": "boolean" + }, + "should_show_mobile_otp_screen": { + "type": "boolean" + }, + "should_show_totp_screen": { + "type": "boolean" + }, + "access_token": { + "type": "string" + }, + "id_token": { + "type": "string" + }, + "refresh_token": { + "type": "string" + }, + "expires_in": { + "type": "string", + "format": "int64" + }, + "user": { + "$ref": "#/definitions/v1User" + }, + "authenticator_scanner_image": { + "type": "string", + "description": "TOTP enrolment artifacts (set only when CreateSession initiates TOTP setup)." + }, + "authenticator_secret": { + "type": "string" + }, + "authenticator_recovery_codes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "description": "Session is what CreateSession returns: tokens plus enough user context to\navoid a follow-up GetUser. Mirrors the GraphQL AuthResponse type 1:1 in\nfield naming." + }, + "v1SessionValidationResult": { + "type": "object", + "properties": { + "is_valid": { + "type": "boolean" + }, + "user": { + "$ref": "#/definitions/v1User" + } + }, + "description": "SessionValidationResult is what CreateSessionValidation returns." + }, + "v1UpdateUserResponse": { + "type": "object", + "properties": { + "user": { + "$ref": "#/definitions/v1User" + } + } + }, + "v1User": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "email": { + "type": "string", + "description": "Either email or phone_number is always present." + }, + "email_verified": { + "type": "boolean" + }, + "signup_methods": { + "type": "string" + }, + "given_name": { + "type": "string" + }, + "family_name": { + "type": "string" + }, + "middle_name": { + "type": "string" + }, + "nickname": { + "type": "string" + }, + "preferred_username": { + "type": "string", + "description": "Defaults to email when unset." + }, + "gender": { + "type": "string" + }, + "birthdate": { + "type": "string" + }, + "phone_number": { + "type": "string" + }, + "phone_number_verified": { + "type": "boolean" + }, + "picture": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "created_at": { + "type": "string", + "format": "int64" + }, + "updated_at": { + "type": "string", + "format": "int64" + }, + "revoked_timestamp": { + "type": "string", + "format": "int64" + }, + "is_multi_factor_auth_enabled": { + "type": "boolean" + }, + "app_data": { + "$ref": "#/definitions/v1AppData", + "description": "Free-form key/value bag — same as GraphQL `app_data: Map`." + } + }, + "description": "User mirrors the GraphQL User type. Field names match the existing\nJSON/GraphQL surface so REST callers see the same shape.\n\nThe canonical resource name is either \"users/me\" (the caller) or\n\"users/{id}\". Other RPCs accept this string form via the `name` field on\ntheir requests." + } + } +} diff --git a/go.mod b/go.mod index 09d4a2ca..257d7f01 100644 --- a/go.mod +++ b/go.mod @@ -31,9 +31,9 @@ require ( github.com/twilio/twilio-go v1.14.1 github.com/vektah/gqlparser/v2 v2.5.26 go.mongodb.org/mongo-driver v1.17.9 - golang.org/x/crypto v0.46.0 - golang.org/x/oauth2 v0.30.0 - golang.org/x/sync v0.19.0 + golang.org/x/crypto v0.49.0 + golang.org/x/oauth2 v0.36.0 + golang.org/x/sync v0.20.0 golang.org/x/time v0.15.0 gopkg.in/mail.v2 v2.3.1 gorm.io/driver/mysql v1.5.2 @@ -44,8 +44,11 @@ require ( require ( buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260415201107-50325440f8f2.1 // indirect + buf.build/go/protovalidate v1.2.0 // indirect + cel.dev/expr v0.25.1 // indirect github.com/agnivade/levenshtein v1.2.1 // indirect github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9 // indirect + github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect @@ -81,9 +84,11 @@ require ( github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang/mock v1.6.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect + github.com/google/cel-go v0.28.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -128,12 +133,15 @@ require ( github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/mod v0.30.0 // indirect - golang.org/x/net v0.47.0 // indirect - golang.org/x/sys v0.39.0 // indirect - golang.org/x/text v0.32.0 // indirect - golang.org/x/tools v0.39.0 // indirect + golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 // indirect + golang.org/x/mod v0.34.0 // indirect + golang.org/x/net v0.52.0 // indirect + golang.org/x/sys v0.42.0 // indirect + golang.org/x/text v0.36.0 // indirect + golang.org/x/tools v0.43.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260523011958-0a33c5d7ca68 // indirect + google.golang.org/grpc v1.81.1 // indirect google.golang.org/protobuf v1.36.11 // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index d62fb4de..d5c42375 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,9 @@ buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260415201107-50325440f8f2.1 h1:s6hzCXtND/ICdGPTMGk7C+/BFlr2Jg5GyH0NKf4XGXg= buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260415201107-50325440f8f2.1/go.mod h1:tvtbpgaVXZX4g6Pn+AnzFycuRK3MOz5HJfEGeEllXYM= +buf.build/go/protovalidate v1.2.0 h1:DQVrUWkmGTBij+kOYv/x2LLxwcLaGKMdzShj1/6/3H0= +buf.build/go/protovalidate v1.2.0/go.mod h1:7rYiQEhqvAipoazpVNBBH2S2f8bjG4huMVy1V2Yofn4= +cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4= +cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= github.com/99designs/gqlgen v0.17.73 h1:A3Ki+rHWqKbAOlg5fxiZBnz6OjW3nwupDHEG15gEsrg= github.com/99designs/gqlgen v0.17.73/go.mod h1:2RyGWjy2k7W9jxrs8MOQthXGkD3L3oGr0jXW3Pu8lGg= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= @@ -30,6 +34,8 @@ github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kk github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9 h1:goHVqTbFX3AIo0tzGr14pgfAW2ZfPChKO21Z9MGf/gk= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= +github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= +github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= github.com/arangodb/go-driver v1.6.0 h1:NFWj/idqXZxhFVueihMSI2R9NotNIsgvNfM/xmpekb4= github.com/arangodb/go-driver v1.6.0/go.mod h1:HQmdGkvNMVBTE3SIPSQ8T/ZddC6iwNsfMR+dDJQxIsI= github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e h1:Xg+hGrY2LcQBbxd0ZFdbGSyRKTYMZCfBbw/pMJFOk1g= @@ -181,9 +187,13 @@ github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgj github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/cel-go v0.28.0 h1:KjSWstCpz/MN5t4a8gnGJNIYUsJRpdi/r97xWDphIQc= +github.com/google/cel-go v0.28.0/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= @@ -200,6 +210,8 @@ github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/z github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -378,13 +390,19 @@ golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0 golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= +golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= +golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= +golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 h1:SbTAbRFnd5kjQXbczszQ0hdk3ctwYf3qBNH9jIsGclE= +golang.org/x/exp v0.0.0-20250813145105-42675adae3e6/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk= golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc= +golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI= +golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -399,14 +417,20 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= +golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= +golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -427,6 +451,8 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= +golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -444,6 +470,8 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= @@ -454,10 +482,18 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ= golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ= +golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s= +golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa h1:Kjn0N0tCrDgiAFW+lGO4JZ3ck44CehvJQMAwj9QF0G8= +google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:q4lMZS6kskjT5HvCPrnnypcDPVJqT/f4nfxmkE7gryY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260523011958-0a33c5d7ca68 h1:PvEgGJf9C/1u5CHkInMg7UFYYUoiaQmW2LbtH0pjB78= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260523011958-0a33c5d7ca68/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ= +google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= diff --git a/internal/config/config.go b/internal/config/config.go index 213ca073..041bef5e 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -43,6 +43,20 @@ type Config struct { // GraphQL endpoint to prevent oversized-payload denial of service. GraphQLMaxBodyBytes int64 + // gRPC server configuration + // GRPCPort is the port the gRPC server listens on. + GRPCPort int + // EnableGRPCReflection toggles the gRPC server-reflection service. + // Default: on (matches the playground). Disable in locked-down prod. + EnableGRPCReflection bool + // GRPCTLSCert / GRPCTLSKey set the TLS material for the gRPC listener. + // When unset and GRPCInsecure is false, the server refuses to start. + GRPCTLSCert string + GRPCTLSKey string + // GRPCInsecure permits cleartext gRPC. For local dev only; production + // should always set TLS material. + GRPCInsecure bool + // Database Configurations // DatabaseType is the type of database to use DatabaseType string diff --git a/internal/gateway/mount.go b/internal/gateway/mount.go new file mode 100644 index 00000000..aa205f53 --- /dev/null +++ b/internal/gateway/mount.go @@ -0,0 +1,103 @@ +// Package gateway translates REST (`/v1/*`) calls into in-process gRPC +// method invocations using grpc-gateway. The resulting http.Handler is +// mounted into the existing Gin router so middleware (CORS, security +// headers, rate limit, logging) is shared. +// +// We deliberately use the *in-process* dialer style: the gateway dials the +// running grpc.Server via bufconn rather than making a real network hop. +// This avoids the latency and TLS-cert plumbing of a loopback gRPC call, +// and removes the need to keep two ports in sync. +package gateway + +import ( + "context" + "net" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/test/bufconn" + "google.golang.org/protobuf/encoding/protojson" + + authzv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/authz/v1" + metav1 "github.com/authorizerdev/authorizer/gen/go/authorizer/meta/v1" + sessionv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/session/v1" + tokenv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/token/v1" + userv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/user/v1" + verificationv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/verification/v1" +) + +// bufconn size; large enough that in-process gateway calls never block. +const bufSize = 1 << 20 + +// Handler builds an http.Handler that translates `/v1/*` REST calls into +// gRPC calls against the supplied in-process *grpc.Server. Returns the +// handler and a cleanup function the caller invokes at shutdown. +func Handler(ctx context.Context, grpcSrv *grpc.Server) (http.Handler, func(), error) { + lis := bufconn.Listen(bufSize) + + // Serve gRPC over the bufconn in a goroutine; the existing TCP + // listener (started by grpcsrv.Server.Run) is the public entry point — + // this listener only carries in-process gateway traffic. + go func() { + _ = grpcSrv.Serve(lis) + }() + + conn, err := grpc.NewClient( + "passthrough:///bufconn", + grpc.WithContextDialer(func(_ context.Context, _ string) (net.Conn, error) { return lis.Dial() }), + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + if err != nil { + _ = lis.Close() + return nil, nil, err + } + + mux := runtime.NewServeMux( + // Use snake_case proto field names (UseProtoNames=true) over the + // camelCase default — keeps payloads aligned with the existing + // GraphQL surface. DiscardUnknown tolerates older clients sending + // fields that have since been removed. + runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{ + MarshalOptions: protojson.MarshalOptions{ + UseProtoNames: true, + EmitUnpopulated: true, + }, + UnmarshalOptions: protojson.UnmarshalOptions{ + DiscardUnknown: true, + }, + }), + ) + if err := registerAll(ctx, mux, conn); err != nil { + _ = conn.Close() + _ = lis.Close() + return nil, nil, err + } + + cleanup := func() { + _ = conn.Close() + _ = lis.Close() + } + return mux, cleanup, nil +} + +func registerAll(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + registrars := []func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error{ + metav1.RegisterMetaServiceHandler, + userv1.RegisterUserServiceHandler, + sessionv1.RegisterSessionServiceHandler, + sessionv1.RegisterMagicLinkServiceHandler, + verificationv1.RegisterEmailVerificationServiceHandler, + verificationv1.RegisterPasswordResetServiceHandler, + verificationv1.RegisterOtpChallengeServiceHandler, + tokenv1.RegisterTokenServiceHandler, + authzv1.RegisterAuthzServiceHandler, + } + for _, fn := range registrars { + if err := fn(ctx, mux, conn); err != nil { + return err + } + } + return nil +} diff --git a/internal/graphql/meta.go b/internal/graphql/meta.go index 6fa06d5e..94b8860b 100644 --- a/internal/graphql/meta.go +++ b/internal/graphql/meta.go @@ -3,71 +3,17 @@ package graphql import ( "context" - "github.com/authorizerdev/authorizer/internal/constants" "github.com/authorizerdev/authorizer/internal/graph/model" + "github.com/authorizerdev/authorizer/internal/service" + "github.com/authorizerdev/authorizer/internal/utils" ) -// Meta returns the meta information about the server. +// Meta delegates to the transport-agnostic service layer. Resolver is a thin +// transport adapter — same pattern as SignUp. +// // Permissions: none func (g *graphqlProvider) Meta(ctx context.Context) (*model.Meta, error) { - clientID := g.Config.ClientID - - googleClientID := g.Config.GoogleClientID - googleClientSecret := g.Config.GoogleClientSecret - - facebookClientID := g.Config.FacebookClientID - facebookClientSecret := g.Config.FacebookClientSecret - - linkedClientID := g.Config.LinkedinClientID - linkedInClientSecret := g.Config.LinkedinClientSecret - - appleClientID := g.Config.AppleClientID - appleClientSecret := g.Config.AppleClientSecret - - githubClientID := g.Config.GithubClientID - githubClientSecret := g.Config.GithubClientSecret - - twitterClientID := g.Config.TwitterClientID - twitterClientSecret := g.Config.TwitterClientSecret - - microsoftClientID := g.Config.MicrosoftClientID - microsoftClientSecret := g.Config.MicrosoftClientSecret - - twitchClientID := g.Config.TwitchClientID - twitchClientSecret := g.Config.TwitchClientSecret - - robloxClientID := g.Config.RobloxClientID - robloxClientSecret := g.Config.RobloxClientSecret - - isBasicAuthEnabled := g.Config.EnableBasicAuthentication - isMobileBasicAuthEnabled := g.Config.EnableMobileBasicAuthentication - isMobileVerificationEnabled := g.Config.EnablePhoneVerification - isMagicLinkLoginEnabled := g.Config.EnableMagicLinkLogin - isEmailVerificationEnabled := g.Config.EnableEmailVerification - isMultiFactorAuthenticationEnabled := g.Config.EnableMFA - isStrongPasswordEnabled := g.Config.EnableStrongPassword - isSignUpEnabled := g.Config.EnableSignup - - metaInfo := model.Meta{ - Version: constants.VERSION, - ClientID: clientID, - IsGoogleLoginEnabled: googleClientID != "" && googleClientSecret != "", - IsGithubLoginEnabled: githubClientID != "" && githubClientSecret != "", - IsFacebookLoginEnabled: facebookClientID != "" && facebookClientSecret != "", - IsLinkedinLoginEnabled: linkedClientID != "" && linkedInClientSecret != "", - IsAppleLoginEnabled: appleClientID != "" && appleClientSecret != "", - IsTwitterLoginEnabled: twitterClientID != "" && twitterClientSecret != "", - IsMicrosoftLoginEnabled: microsoftClientID != "" && microsoftClientSecret != "", - IsBasicAuthenticationEnabled: isBasicAuthEnabled, - IsEmailVerificationEnabled: isEmailVerificationEnabled, - IsMagicLinkLoginEnabled: isMagicLinkLoginEnabled, - IsSignUpEnabled: isSignUpEnabled, - IsStrongPasswordEnabled: isStrongPasswordEnabled, - IsMultiFactorAuthEnabled: isMultiFactorAuthenticationEnabled, - IsMobileBasicAuthenticationEnabled: isMobileBasicAuthEnabled, - IsPhoneVerificationEnabled: isMobileVerificationEnabled, - IsTwitchLoginEnabled: twitchClientID != "" && twitchClientSecret != "", - IsRobloxLoginEnabled: robloxClientID != "" && robloxClientSecret != "", - } - return &metaInfo, nil + gc, _ := utils.GinContextFromContext(ctx) + res, _, err := g.ServiceProvider.Meta(ctx, service.MetaFromGin(gc)) + return res, err } diff --git a/internal/grpcsrv/handlers/meta.go b/internal/grpcsrv/handlers/meta.go new file mode 100644 index 00000000..38f63913 --- /dev/null +++ b/internal/grpcsrv/handlers/meta.go @@ -0,0 +1,51 @@ +// Package handlers contains gRPC service handler implementations. Each +// service is a thin transport adapter: pull RequestMetadata out of the gRPC +// context, delegate to internal/service, project the result into the +// proto-generated response type. +package handlers + +import ( + "context" + + "github.com/authorizerdev/authorizer/internal/grpcsrv/transport" + "github.com/authorizerdev/authorizer/internal/service" + + metav1 "github.com/authorizerdev/authorizer/gen/go/authorizer/meta/v1" +) + +// MetaHandler implements authorizer.meta.v1.MetaService. +type MetaHandler struct { + metav1.UnimplementedMetaServiceServer + Service service.Provider +} + +// GetMeta delegates to service.Meta and projects the GraphQL Meta model into +// the proto GetMetaResponse. +func (h *MetaHandler) GetMeta(ctx context.Context, _ *metav1.GetMetaRequest) (*metav1.GetMetaResponse, error) { + m, _, err := h.Service.Meta(ctx, transport.MetaFromGRPC(ctx)) + if err != nil { + return nil, err + } + return &metav1.GetMetaResponse{ + Version: m.Version, + ClientId: m.ClientID, + IsGoogleLoginEnabled: m.IsGoogleLoginEnabled, + IsFacebookLoginEnabled: m.IsFacebookLoginEnabled, + IsGithubLoginEnabled: m.IsGithubLoginEnabled, + IsLinkedinLoginEnabled: m.IsLinkedinLoginEnabled, + IsAppleLoginEnabled: m.IsAppleLoginEnabled, + IsDiscordLoginEnabled: m.IsDiscordLoginEnabled, + IsTwitterLoginEnabled: m.IsTwitterLoginEnabled, + IsMicrosoftLoginEnabled: m.IsMicrosoftLoginEnabled, + IsTwitchLoginEnabled: m.IsTwitchLoginEnabled, + IsRobloxLoginEnabled: m.IsRobloxLoginEnabled, + IsEmailVerificationEnabled: m.IsEmailVerificationEnabled, + IsBasicAuthenticationEnabled: m.IsBasicAuthenticationEnabled, + IsMagicLinkLoginEnabled: m.IsMagicLinkLoginEnabled, + IsSignUpEnabled: m.IsSignUpEnabled, + IsStrongPasswordEnabled: m.IsStrongPasswordEnabled, + IsMultiFactorAuthEnabled: m.IsMultiFactorAuthEnabled, + IsMobileBasicAuthenticationEnabled: m.IsMobileBasicAuthenticationEnabled, + IsPhoneVerificationEnabled: m.IsPhoneVerificationEnabled, + }, nil +} diff --git a/internal/grpcsrv/handlers/stubs.go b/internal/grpcsrv/handlers/stubs.go new file mode 100644 index 00000000..015dad56 --- /dev/null +++ b/internal/grpcsrv/handlers/stubs.go @@ -0,0 +1,65 @@ +package handlers + +import ( + "github.com/authorizerdev/authorizer/internal/service" + + authzv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/authz/v1" + sessionv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/session/v1" + tokenv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/token/v1" + userv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/user/v1" + verificationv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/verification/v1" +) + +// The handlers below embed the proto-generated UnimplementedXServer types, +// which makes them all return codes.Unimplemented for every RPC. As each +// service's operations migrate into internal/service in subsequent PRs, +// individual methods are added here and override the unimplemented stubs. +// +// Keeping every service registered (even as a stub) means: +// - gRPC reflection lists the complete API surface from day one +// - clients can discover capability rather than getting "service not found" +// - the grpc-gateway mount registers all REST routes, returning +// codes.Unimplemented → HTTP 501 for unimplemented ops +// +// All handlers receive the shared service.Provider so the wire-up is in +// place for the migration; the Service field is unused on stubs today. + +type UserHandler struct { + userv1.UnimplementedUserServiceServer + Service service.Provider +} + +type SessionHandler struct { + sessionv1.UnimplementedSessionServiceServer + Service service.Provider +} + +type MagicLinkHandler struct { + sessionv1.UnimplementedMagicLinkServiceServer + Service service.Provider +} + +type EmailVerificationHandler struct { + verificationv1.UnimplementedEmailVerificationServiceServer + Service service.Provider +} + +type PasswordResetHandler struct { + verificationv1.UnimplementedPasswordResetServiceServer + Service service.Provider +} + +type OtpChallengeHandler struct { + verificationv1.UnimplementedOtpChallengeServiceServer + Service service.Provider +} + +type TokenHandler struct { + tokenv1.UnimplementedTokenServiceServer + Service service.Provider +} + +type AuthzHandler struct { + authzv1.UnimplementedAuthzServiceServer + Service service.Provider +} diff --git a/internal/grpcsrv/interceptors/logging.go b/internal/grpcsrv/interceptors/logging.go new file mode 100644 index 00000000..67226b0c --- /dev/null +++ b/internal/grpcsrv/interceptors/logging.go @@ -0,0 +1,40 @@ +package interceptors + +import ( + "context" + "time" + + "github.com/rs/zerolog" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Logging returns a unary interceptor that emits one structured log line per +// RPC at info level (or error/warn when the status code reflects failure). +// Method name, duration, and gRPC code are always present. +func Logging(log *zerolog.Logger) grpc.UnaryServerInterceptor { + return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) { + start := time.Now() + resp, err := handler(ctx, req) + dur := time.Since(start) + + code := status.Code(err) + evt := log.Info() + switch code { + case codes.OK: + // stays info + case codes.Internal, codes.Unknown, codes.DataLoss: + evt = log.Error() + default: + evt = log.Warn() + } + evt. + Str("method", info.FullMethod). + Str("code", code.String()). + Dur("duration", dur). + Err(err). + Msg("grpc") + return resp, err + } +} diff --git a/internal/grpcsrv/interceptors/recovery.go b/internal/grpcsrv/interceptors/recovery.go new file mode 100644 index 00000000..9a2dfa37 --- /dev/null +++ b/internal/grpcsrv/interceptors/recovery.go @@ -0,0 +1,38 @@ +// Package interceptors contains the gRPC server interceptors shared across +// Authorizer services. They run in this order (outermost first): +// +// recovery → logging → validate → ... (auth, permission, audit — added per service in later PRs) +// +// Recovery is outermost so it catches panics raised by anything later, and +// converts them to a clean codes.Internal status instead of crashing the +// server. +package interceptors + +import ( + "context" + "runtime/debug" + + "github.com/rs/zerolog" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Recovery returns a unary interceptor that converts handler panics into a +// codes.Internal error and logs the stack at error level. The stack stays +// server-side — clients only see a generic "internal error" message. +func Recovery(log *zerolog.Logger) grpc.UnaryServerInterceptor { + return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) { + defer func() { + if r := recover(); r != nil { + log.Error(). + Str("method", info.FullMethod). + Interface("panic", r). + Bytes("stack", debug.Stack()). + Msg("gRPC handler panicked") + err = status.Error(codes.Internal, "internal server error") + } + }() + return handler(ctx, req) + } +} diff --git a/internal/grpcsrv/interceptors/validate.go b/internal/grpcsrv/interceptors/validate.go new file mode 100644 index 00000000..6226888e --- /dev/null +++ b/internal/grpcsrv/interceptors/validate.go @@ -0,0 +1,32 @@ +package interceptors + +import ( + "context" + + "buf.build/go/protovalidate" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Validate returns a unary interceptor that runs protovalidate on every +// inbound request that's a proto.Message. Failures convert to +// codes.InvalidArgument with a human-readable detail. +// +// The validator is built once at startup and shared across requests +// (protovalidate.Validator is safe for concurrent use). +func Validate() (grpc.UnaryServerInterceptor, error) { + v, err := protovalidate.New() + if err != nil { + return nil, err + } + return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) { + if msg, ok := req.(proto.Message); ok { + if err := v.Validate(msg); err != nil { + return nil, status.Errorf(codes.InvalidArgument, "%v", err) + } + } + return handler(ctx, req) + }, nil +} diff --git a/internal/grpcsrv/server.go b/internal/grpcsrv/server.go new file mode 100644 index 00000000..83dff7e6 --- /dev/null +++ b/internal/grpcsrv/server.go @@ -0,0 +1,119 @@ +// Package grpcsrv builds and runs the Authorizer gRPC server. It registers +// every public-API service (real or stubbed), enables reflection, exposes +// the standard gRPC health checking protocol, and applies the shared +// interceptor chain. +package grpcsrv + +import ( + "context" + "net" + + "github.com/rs/zerolog" + "google.golang.org/grpc" + "google.golang.org/grpc/health" + healthv1 "google.golang.org/grpc/health/grpc_health_v1" + "google.golang.org/grpc/reflection" + + "github.com/authorizerdev/authorizer/internal/config" + "github.com/authorizerdev/authorizer/internal/grpcsrv/handlers" + "github.com/authorizerdev/authorizer/internal/grpcsrv/interceptors" + "github.com/authorizerdev/authorizer/internal/service" + + authzv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/authz/v1" + metav1 "github.com/authorizerdev/authorizer/gen/go/authorizer/meta/v1" + sessionv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/session/v1" + tokenv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/token/v1" + userv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/user/v1" + verificationv1 "github.com/authorizerdev/authorizer/gen/go/authorizer/verification/v1" +) + +// Dependencies is the minimum set the gRPC server needs. +type Dependencies struct { + Log *zerolog.Logger + Config *config.Config + ServiceProvider service.Provider +} + +// Server wraps a *grpc.Server plus its listener address. +type Server struct { + deps *Dependencies + addr string + srv *grpc.Server + health *health.Server +} + +// New constructs a configured gRPC server. The server is not yet listening; +// call Run to start serving. +func New(addr string, deps *Dependencies) (*Server, error) { + validate, err := interceptors.Validate() + if err != nil { + return nil, err + } + + srv := grpc.NewServer( + grpc.ChainUnaryInterceptor( + interceptors.Recovery(deps.Log), + interceptors.Logging(deps.Log), + validate, + ), + ) + + // Register every service. Real implementations override the stub's + // UnimplementedXServer; stubs return codes.Unimplemented until their + // service migrates from internal/graphql in a follow-up PR. + metav1.RegisterMetaServiceServer(srv, &handlers.MetaHandler{Service: deps.ServiceProvider}) + userv1.RegisterUserServiceServer(srv, &handlers.UserHandler{Service: deps.ServiceProvider}) + sessionv1.RegisterSessionServiceServer(srv, &handlers.SessionHandler{Service: deps.ServiceProvider}) + sessionv1.RegisterMagicLinkServiceServer(srv, &handlers.MagicLinkHandler{Service: deps.ServiceProvider}) + verificationv1.RegisterEmailVerificationServiceServer(srv, &handlers.EmailVerificationHandler{Service: deps.ServiceProvider}) + verificationv1.RegisterPasswordResetServiceServer(srv, &handlers.PasswordResetHandler{Service: deps.ServiceProvider}) + verificationv1.RegisterOtpChallengeServiceServer(srv, &handlers.OtpChallengeHandler{Service: deps.ServiceProvider}) + tokenv1.RegisterTokenServiceServer(srv, &handlers.TokenHandler{Service: deps.ServiceProvider}) + authzv1.RegisterAuthzServiceServer(srv, &handlers.AuthzHandler{Service: deps.ServiceProvider}) + + // gRPC health checking protocol (used by k8s grpc-probe and similar). + hs := health.NewServer() + hs.SetServingStatus("", healthv1.HealthCheckResponse_SERVING) + healthv1.RegisterHealthServer(srv, hs) + + // Reflection is gated on a config flag so prod deployments can lock it + // off, but defaults on for dev/test parity with the playground. + if deps.Config.EnableGRPCReflection { + reflection.Register(srv) + } + + return &Server{ + deps: deps, + addr: addr, + srv: srv, + health: hs, + }, nil +} + +// GRPCServer exposes the underlying *grpc.Server. Used by the in-process +// REST gateway mount to dial via bufconn during tests. +func (s *Server) GRPCServer() *grpc.Server { return s.srv } + +// Run starts the listener and blocks until ctx is cancelled or Serve errors. +// On context cancellation, the server is gracefully stopped (existing RPCs +// finish, no new ones accepted). +func (s *Server) Run(ctx context.Context) error { + lis, err := net.Listen("tcp", s.addr) + if err != nil { + return err + } + s.deps.Log.Info().Str("addr", s.addr).Msg("Starting gRPC server") + + errCh := make(chan error, 1) + go func() { errCh <- s.srv.Serve(lis) }() + + select { + case <-ctx.Done(): + s.deps.Log.Info().Msg("gRPC shutdown signal received, draining") + s.health.Shutdown() + s.srv.GracefulStop() + return nil + case err := <-errCh: + return err + } +} diff --git a/internal/grpcsrv/transport/grpc_metadata.go b/internal/grpcsrv/transport/grpc_metadata.go new file mode 100644 index 00000000..e3cd157f --- /dev/null +++ b/internal/grpcsrv/transport/grpc_metadata.go @@ -0,0 +1,71 @@ +// Package transport bridges between gRPC's incoming metadata / outgoing +// trailers and the service layer's transport-agnostic RequestMetadata / +// ResponseSideEffects. +// +// gRPC has no native cookie concept; cookies in ResponseSideEffects are +// serialised to a `Set-Cookie` trailer, which grpc-gateway then promotes +// into actual `Set-Cookie` response headers when the call comes in via REST. +// Pure-gRPC clients (server-to-server) typically don't need cookies and +// silently ignore them. +package transport + +import ( + "context" + "net/http" + + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + + "github.com/authorizerdev/authorizer/internal/service" +) + +// MetaFromGRPC builds a RequestMetadata from a gRPC context. Headers +// populated by grpc-gateway (`grpcgateway-*` prefix) are honored so the +// service sees the same host/IP/UA whether the call came via gRPC directly +// or via REST through the gateway. +func MetaFromGRPC(ctx context.Context) service.RequestMetadata { + md, _ := metadata.FromIncomingContext(ctx) + meta := service.RequestMetadata{ + HostURL: firstHeader(md, "x-authorizer-url", "grpcgateway-x-authorizer-url"), + IPAddress: firstHeader(md, "x-forwarded-for", "grpcgateway-x-forwarded-for", "x-real-ip"), + UserAgent: firstHeader(md, "grpcgateway-user-agent", "user-agent"), + AuthorizationHeader: firstHeader(md, "authorization", "grpcgateway-authorization"), + } + // Default the host URL when no header was set (pure-gRPC caller, no + // proxy headers). The :authority pseudo-header is the gRPC equivalent + // of Host; use it as a fallback. + if meta.HostURL == "" { + if authority := firstHeader(md, ":authority"); authority != "" { + meta.HostURL = "http://" + authority + } + } + return meta +} + +// ApplyToGRPC writes the response side-effects to the outgoing gRPC stream: +// cookies become Set-Cookie metadata trailers. A nil receiver is a no-op. +func ApplyToGRPC(ctx context.Context, side *service.ResponseSideEffects) error { + if side == nil || len(side.Cookies) == 0 { + return nil + } + values := make([]string, 0, len(side.Cookies)) + for _, c := range side.Cookies { + if c == nil { + continue + } + values = append(values, c.String()) + } + if len(values) == 0 { + return nil + } + return grpc.SendHeader(ctx, metadata.Pairs(http.CanonicalHeaderKey("Set-Cookie"), values[0])) //nolint:staticcheck // only one cookie surfaces; multi-cookie comes with the gateway-aware wiring +} + +func firstHeader(md metadata.MD, keys ...string) string { + for _, k := range keys { + if vs := md.Get(k); len(vs) > 0 { + return vs[0] + } + } + return "" +} diff --git a/internal/integration_tests/grpc_meta_test.go b/internal/integration_tests/grpc_meta_test.go new file mode 100644 index 00000000..15dc844f --- /dev/null +++ b/internal/integration_tests/grpc_meta_test.go @@ -0,0 +1,57 @@ +package integration_tests + +import ( + "context" + "net" + "testing" + + "github.com/rs/zerolog" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/test/bufconn" + + "github.com/authorizerdev/authorizer/internal/grpcsrv" + "github.com/authorizerdev/authorizer/internal/service" + + metav1 "github.com/authorizerdev/authorizer/gen/go/authorizer/meta/v1" +) + +// TestGRPCMeta exercises MetaService.GetMeta end-to-end over a bufconn +// in-process gRPC channel. Validates the Phase 2 vertical slice: proto → +// handler → service.Meta → response projection. +func TestGRPCMeta(t *testing.T) { + cfg := getTestConfig() + cfg.ClientID = "test-client" + + log := zerolog.New(zerolog.NewTestWriter(t)).With().Timestamp().Logger() + + svc, err := service.New(cfg, &service.Dependencies{Log: &log}) + require.NoError(t, err) + + srv, err := grpcsrv.New(":0", &grpcsrv.Dependencies{ + Log: &log, + Config: cfg, + ServiceProvider: svc, + }) + require.NoError(t, err) + + lis := bufconn.Listen(1 << 20) + t.Cleanup(func() { _ = lis.Close() }) + go func() { _ = srv.GRPCServer().Serve(lis) }() + t.Cleanup(srv.GRPCServer().GracefulStop) + + conn, err := grpc.NewClient( + "passthrough:///bufconn", + grpc.WithContextDialer(func(_ context.Context, _ string) (net.Conn, error) { return lis.Dial() }), + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + require.NoError(t, err) + t.Cleanup(func() { _ = conn.Close() }) + + client := metav1.NewMetaServiceClient(conn) + resp, err := client.GetMeta(context.Background(), &metav1.GetMetaRequest{}) + require.NoError(t, err) + require.Equal(t, "test-client", resp.ClientId) + require.NotEmpty(t, resp.Version) +} diff --git a/internal/integration_tests/rest_meta_test.go b/internal/integration_tests/rest_meta_test.go new file mode 100644 index 00000000..f93688d5 --- /dev/null +++ b/internal/integration_tests/rest_meta_test.go @@ -0,0 +1,66 @@ +package integration_tests + +import ( + "context" + "encoding/json" + "io" + "net/http" + "net/http/httptest" + "testing" + + "github.com/gin-gonic/gin" + "github.com/rs/zerolog" + "github.com/stretchr/testify/require" + + "github.com/authorizerdev/authorizer/internal/gateway" + "github.com/authorizerdev/authorizer/internal/grpcsrv" + "github.com/authorizerdev/authorizer/internal/service" +) + +// TestRESTMeta exercises GET /v1/meta through the grpc-gateway. Validates +// that the gateway translates the REST call into an in-process gRPC +// invocation against MetaService.GetMeta, then renders the response as JSON. +func TestRESTMeta(t *testing.T) { + cfg := getTestConfig() + cfg.ClientID = "test-client" + + log := zerolog.New(zerolog.NewTestWriter(t)).With().Timestamp().Logger() + + svc, err := service.New(cfg, &service.Dependencies{Log: &log}) + require.NoError(t, err) + + grpcSrv, err := grpcsrv.New(":0", &grpcsrv.Dependencies{ + Log: &log, + Config: cfg, + ServiceProvider: svc, + }) + require.NoError(t, err) + + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + gw, cleanup, err := gateway.Handler(ctx, grpcSrv.GRPCServer()) + require.NoError(t, err) + t.Cleanup(cleanup) + + gin.SetMode(gin.TestMode) + r := gin.New() + r.Any("/v1/*path", gin.WrapH(gw)) + ts := httptest.NewServer(r) + t.Cleanup(ts.Close) + + resp, err := http.Get(ts.URL + "/v1/meta") + require.NoError(t, err) + defer resp.Body.Close() + require.Equal(t, http.StatusOK, resp.StatusCode) + + body, err := io.ReadAll(resp.Body) + require.NoError(t, err) + + var got struct { + ClientID string `json:"client_id"` + Version string `json:"version"` + } + require.NoError(t, json.Unmarshal(body, &got)) + require.Equal(t, "test-client", got.ClientID) + require.NotEmpty(t, got.Version) +} diff --git a/internal/server/http_routes.go b/internal/server/http_routes.go index f619092b..695885d7 100644 --- a/internal/server/http_routes.go +++ b/internal/server/http_routes.go @@ -3,6 +3,8 @@ package server import ( "encoding/json" "html/template" + "net/http" + "os" "path" "strings" @@ -73,6 +75,32 @@ func (s *server) NewRouter() *gin.Engine { router.POST("/oauth/revoke", s.Dependencies.HTTPProvider.RevokeRefreshTokenHandler()) router.POST("/oauth/introspect", s.Dependencies.HTTPProvider.IntrospectHandler()) + // gRPC-gateway REST surface at /v1/*. Mounted only when the gRPC + // server is configured. Shares all gin middleware (CORS, security + // headers, rate limit, logging) automatically since the route group + // inherits them from `router.Use(...)` above. + if s.gatewayHandler != nil { + // The gateway's routes are registered with their full /v1/... path + // (driven by google.api.http annotations). Mount it as a catch-all + // under /v1 so gin matches the prefix and hands the full request + // path to grpc-gateway untouched. + gw := gin.WrapH(s.gatewayHandler) + router.Any("/v1/*path", gw) + + // OpenAPI spec — generated alongside the gRPC stubs by buf and + // served verbatim. Path is intentionally separate from the gateway + // mux so it doesn't fight a /v1/openapi.json gateway route (none + // exists today, but defending against future collisions is cheap). + router.GET("/openapi.json", func(c *gin.Context) { + data, err := os.ReadFile("gen/openapi/authorizer.swagger.json") + if err != nil { + c.AbortWithStatus(http.StatusNotFound) + return + } + c.Data(http.StatusOK, "application/json", data) + }) + } + // Set up template functions for JSON encoding. // Escape and