identity

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package identity is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	UserService_SignUp_FullMethodName       = "/UserService/SignUp"
	UserService_SignIn_FullMethodName       = "/UserService/SignIn"
	UserService_Auth_FullMethodName         = "/UserService/AuthN"
	UserService_RefreshToken_FullMethodName = "/UserService/RefreshToken"
)

Variables

View Source
var (
	UserCredentialType_name = map[int32]string{
		0: "NONE",
		1: "USERNAME",
		2: "EMAIL",
		3: "PHONE",
	}
	UserCredentialType_value = map[string]int32{
		"NONE":     0,
		"USERNAME": 1,
		"EMAIL":    2,
		"PHONE":    3,
	}
)

Enum value maps for UserCredentialType.

View Source
var File_identity_user_proto protoreflect.FileDescriptor
View Source
var UserService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "UserService",
	HandlerType: (*UserServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SignUp",
			Handler:    _UserService_SignUp_Handler,
		},
		{
			MethodName: "SignIn",
			Handler:    _UserService_SignIn_Handler,
		},
		{
			MethodName: "AuthN",
			Handler:    _UserService_Auth_Handler,
		},
		{
			MethodName: "RefreshToken",
			Handler:    _UserService_RefreshToken_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "identity/user.proto",
}

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)

Functions

func MicroRegisterUserServiceHandler

func MicroRegisterUserServiceHandler(s server.Server, hdlr UserServiceHandler, opts ...server.HandlerOption) error

func NewUserServiceEndpoints

func NewUserServiceEndpoints() []*api.Endpoint

func RegisterUserServiceHandler

func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterUserServiceHandler registers the http handlers for service UserService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterUserServiceHandlerClient

func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error

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.

func RegisterUserServiceHandlerFromEndpoint

func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterUserServiceHandlerFromEndpoint is same as RegisterUserServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterUserServiceHandlerServer

func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error

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.

func RegisterUserServiceServer

func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)

Types

type RefreshTokenRequest added in v0.0.3

type RefreshTokenRequest struct {
	RefreshToken string `protobuf:"bytes,1,opt,name=refreshToken,proto3" json:"refreshToken,omitempty"`
	// contains filtered or unexported fields
}

func (*RefreshTokenRequest) Descriptor deprecated added in v0.0.3

func (*RefreshTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use RefreshTokenRequest.ProtoReflect.Descriptor instead.

func (*RefreshTokenRequest) GetRefreshToken added in v0.0.3

func (x *RefreshTokenRequest) GetRefreshToken() string

func (*RefreshTokenRequest) ProtoMessage added in v0.0.3

func (*RefreshTokenRequest) ProtoMessage()

func (*RefreshTokenRequest) ProtoReflect added in v0.0.3

func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message

func (*RefreshTokenRequest) Reset added in v0.0.3

func (x *RefreshTokenRequest) Reset()

func (*RefreshTokenRequest) String added in v0.0.3

func (x *RefreshTokenRequest) String() string

type TokenResponse added in v0.0.3

type TokenResponse struct {
	AccessToken  string `protobuf:"bytes,1,opt,name=accessToken,proto3" json:"accessToken,omitempty"`
	RefreshToken string `protobuf:"bytes,2,opt,name=refreshToken,proto3" json:"refreshToken,omitempty"`
	Exp          int64  `protobuf:"varint,3,opt,name=exp,proto3" json:"exp,omitempty"`
	Iat          int64  `protobuf:"varint,4,opt,name=iat,proto3" json:"iat,omitempty"`
	Iss          string `protobuf:"bytes,5,opt,name=iss,proto3" json:"iss,omitempty"`
	// contains filtered or unexported fields
}

func (*TokenResponse) Descriptor deprecated added in v0.0.3

func (*TokenResponse) Descriptor() ([]byte, []int)

Deprecated: Use TokenResponse.ProtoReflect.Descriptor instead.

func (*TokenResponse) GetAccessToken added in v0.0.3

func (x *TokenResponse) GetAccessToken() string

func (*TokenResponse) GetExp added in v0.0.3

func (x *TokenResponse) GetExp() int64

func (*TokenResponse) GetIat added in v0.0.3

func (x *TokenResponse) GetIat() int64

func (*TokenResponse) GetIss added in v0.0.3

func (x *TokenResponse) GetIss() string

func (*TokenResponse) GetRefreshToken added in v0.0.3

func (x *TokenResponse) GetRefreshToken() string

func (*TokenResponse) ProtoMessage added in v0.0.3

func (*TokenResponse) ProtoMessage()

func (*TokenResponse) ProtoReflect added in v0.0.3

func (x *TokenResponse) ProtoReflect() protoreflect.Message

func (*TokenResponse) Reset added in v0.0.3

func (x *TokenResponse) Reset()

func (*TokenResponse) String added in v0.0.3

func (x *TokenResponse) String() string

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) Auth added in v0.0.3

func (UnimplementedUserServiceServer) RefreshToken added in v0.0.3

func (UnimplementedUserServiceServer) SignIn

func (UnimplementedUserServiceServer) SignUp

type UnsafeUserServiceServer

type UnsafeUserServiceServer interface {
	// contains filtered or unexported methods
}

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 UserAuthRequest added in v0.0.3

type UserAuthRequest struct {
	// contains filtered or unexported fields
}

func (*UserAuthRequest) Descriptor deprecated added in v0.0.3

func (*UserAuthRequest) Descriptor() ([]byte, []int)

Deprecated: Use UserAuthRequest.ProtoReflect.Descriptor instead.

func (*UserAuthRequest) ProtoMessage added in v0.0.3

func (*UserAuthRequest) ProtoMessage()

func (*UserAuthRequest) ProtoReflect added in v0.0.3

func (x *UserAuthRequest) ProtoReflect() protoreflect.Message

func (*UserAuthRequest) Reset added in v0.0.3

func (x *UserAuthRequest) Reset()

func (*UserAuthRequest) String added in v0.0.3

func (x *UserAuthRequest) String() string

type UserCredentialType

type UserCredentialType int32

user credential type enum

const (
	UserCredentialType_NONE     UserCredentialType = 0
	UserCredentialType_USERNAME UserCredentialType = 1
	UserCredentialType_EMAIL    UserCredentialType = 2
	UserCredentialType_PHONE    UserCredentialType = 3
)

func (UserCredentialType) Descriptor

func (UserCredentialType) Enum

func (UserCredentialType) EnumDescriptor deprecated

func (UserCredentialType) EnumDescriptor() ([]byte, []int)

Deprecated: Use UserCredentialType.Descriptor instead.

func (UserCredentialType) Number

func (UserCredentialType) String

func (x UserCredentialType) String() string

func (UserCredentialType) Type

type UserService

type UserService interface {
	SignUp(ctx context.Context, in *UserSignUpRequest, opts ...client.CallOption) (*emptypb.Empty, error)
	SignIn(ctx context.Context, in *UserSignInRequest, opts ...client.CallOption) (*UserSignInResponse, error)
	Auth(ctx context.Context, in *UserAuthRequest, opts ...client.CallOption) (*TokenResponse, error)
	RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...client.CallOption) (*TokenResponse, error)
}

func NewUserService

func NewUserService(name string, c client.Client) UserService

type UserServiceClient

type UserServiceClient interface {
	SignUp(ctx context.Context, in *UserSignUpRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	SignIn(ctx context.Context, in *UserSignInRequest, opts ...grpc.CallOption) (*UserSignInResponse, error)
	Auth(ctx context.Context, in *UserAuthRequest, opts ...grpc.CallOption) (*TokenResponse, error)
	RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*TokenResponse, error)
}

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.

type UserServiceServer

type UserServiceServer interface {
	SignUp(context.Context, *UserSignUpRequest) (*emptypb.Empty, error)
	SignIn(context.Context, *UserSignInRequest) (*UserSignInResponse, error)
	Auth(context.Context, *UserAuthRequest) (*TokenResponse, error)
	RefreshToken(context.Context, *RefreshTokenRequest) (*TokenResponse, error)
	// contains filtered or unexported methods
}

UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility

type UserSignInRequest

type UserSignInRequest struct {
	Identifier string             `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
	Password   string             `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	Type       UserCredentialType `protobuf:"varint,3,opt,name=type,proto3,enum=UserCredentialType" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*UserSignInRequest) Descriptor deprecated

func (*UserSignInRequest) Descriptor() ([]byte, []int)

Deprecated: Use UserSignInRequest.ProtoReflect.Descriptor instead.

func (*UserSignInRequest) GetIdentifier added in v0.0.3

func (x *UserSignInRequest) GetIdentifier() string

func (*UserSignInRequest) GetPassword

func (x *UserSignInRequest) GetPassword() string

func (*UserSignInRequest) GetType

func (*UserSignInRequest) ProtoMessage

func (*UserSignInRequest) ProtoMessage()

func (*UserSignInRequest) ProtoReflect

func (x *UserSignInRequest) ProtoReflect() protoreflect.Message

func (*UserSignInRequest) Reset

func (x *UserSignInRequest) Reset()

func (*UserSignInRequest) String

func (x *UserSignInRequest) String() string

type UserSignInResponse

type UserSignInResponse struct {
	// contains filtered or unexported fields
}

func (*UserSignInResponse) Descriptor deprecated

func (*UserSignInResponse) Descriptor() ([]byte, []int)

Deprecated: Use UserSignInResponse.ProtoReflect.Descriptor instead.

func (*UserSignInResponse) ProtoMessage

func (*UserSignInResponse) ProtoMessage()

func (*UserSignInResponse) ProtoReflect

func (x *UserSignInResponse) ProtoReflect() protoreflect.Message

func (*UserSignInResponse) Reset

func (x *UserSignInResponse) Reset()

func (*UserSignInResponse) String

func (x *UserSignInResponse) String() string

type UserSignUpRequest

type UserSignUpRequest struct {
	Identifier string             `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
	Password   string             `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	Type       UserCredentialType `protobuf:"varint,3,opt,name=type,proto3,enum=UserCredentialType" json:"type,omitempty"`
	// contains filtered or unexported fields
}

request & response struct

func (*UserSignUpRequest) Descriptor deprecated

func (*UserSignUpRequest) Descriptor() ([]byte, []int)

Deprecated: Use UserSignUpRequest.ProtoReflect.Descriptor instead.

func (*UserSignUpRequest) GetIdentifier added in v0.0.3

func (x *UserSignUpRequest) GetIdentifier() string

func (*UserSignUpRequest) GetPassword

func (x *UserSignUpRequest) GetPassword() string

func (*UserSignUpRequest) GetType

func (*UserSignUpRequest) ProtoMessage

func (*UserSignUpRequest) ProtoMessage()

func (*UserSignUpRequest) ProtoReflect

func (x *UserSignUpRequest) ProtoReflect() protoreflect.Message

func (*UserSignUpRequest) Reset

func (x *UserSignUpRequest) Reset()

func (*UserSignUpRequest) String

func (x *UserSignUpRequest) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL