sso

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: GPL-3.0 Imports: 31 Imported by: 1

Documentation

Overview

Package sso is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	SSO_RegisterUser_FullMethodName = "/sso.SSO/RegisterUser"
	SSO_LoginUser_FullMethodName    = "/sso.SSO/LoginUser"
	SSO_VerifyToken_FullMethodName  = "/sso.SSO/VerifyToken"
)

Variables

View Source
var File_sso_v1_sso_proto protoreflect.FileDescriptor
View Source
var SSO_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "sso.SSO",
	HandlerType: (*SSOServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RegisterUser",
			Handler:    _SSO_RegisterUser_Handler,
		},
		{
			MethodName: "LoginUser",
			Handler:    _SSO_LoginUser_Handler,
		},
		{
			MethodName: "VerifyToken",
			Handler:    _SSO_VerifyToken_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "sso/v1/sso.proto",
}

SSO_ServiceDesc is the grpc.ServiceDesc for SSO service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterSSOHandler

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

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

func RegisterSSOHandlerClient

func RegisterSSOHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SSOClient) error

RegisterSSOHandlerClient registers the http handlers for service SSO to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SSOClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SSOClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SSOClient" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterSSOHandlerFromEndpoint

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

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

func RegisterSSOHandlerServer

func RegisterSSOHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SSOServer) error

RegisterSSOHandlerServer registers the http handlers for service SSO to "mux". UnaryRPC :call SSOServer 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 RegisterSSOHandlerFromEndpoint 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 RegisterSSOServer

func RegisterSSOServer(s grpc.ServiceRegistrar, srv SSOServer)

Types

type LoginUserRequest

type LoginUserRequest struct {
	Email    string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginUserRequest) Descriptor deprecated

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

Deprecated: Use LoginUserRequest.ProtoReflect.Descriptor instead.

func (*LoginUserRequest) GetEmail

func (x *LoginUserRequest) GetEmail() string

func (*LoginUserRequest) GetPassword

func (x *LoginUserRequest) GetPassword() string

func (*LoginUserRequest) ProtoMessage

func (*LoginUserRequest) ProtoMessage()

func (*LoginUserRequest) ProtoReflect

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

func (*LoginUserRequest) Reset

func (x *LoginUserRequest) Reset()

func (*LoginUserRequest) String

func (x *LoginUserRequest) String() string

func (*LoginUserRequest) Validate

func (m *LoginUserRequest) Validate() error

Validate checks the field values on LoginUserRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*LoginUserRequest) ValidateAll

func (m *LoginUserRequest) ValidateAll() error

ValidateAll checks the field values on LoginUserRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in LoginUserRequestMultiError, or nil if none found.

type LoginUserRequestMultiError

type LoginUserRequestMultiError []error

LoginUserRequestMultiError is an error wrapping multiple validation errors returned by LoginUserRequest.ValidateAll() if the designated constraints aren't met.

func (LoginUserRequestMultiError) AllErrors

func (m LoginUserRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (LoginUserRequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type LoginUserRequestValidationError

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

LoginUserRequestValidationError is the validation error returned by LoginUserRequest.Validate if the designated constraints aren't met.

func (LoginUserRequestValidationError) Cause

Cause function returns cause value.

func (LoginUserRequestValidationError) Error

Error satisfies the builtin error interface

func (LoginUserRequestValidationError) ErrorName

ErrorName returns error name.

func (LoginUserRequestValidationError) Field

Field function returns field value.

func (LoginUserRequestValidationError) Key

Key function returns key value.

func (LoginUserRequestValidationError) Reason

Reason function returns reason value.

type LoginUserResponse

type LoginUserResponse struct {
	Token  string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	UserId int64  `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginUserResponse) Descriptor deprecated

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

Deprecated: Use LoginUserResponse.ProtoReflect.Descriptor instead.

func (*LoginUserResponse) GetToken

func (x *LoginUserResponse) GetToken() string

func (*LoginUserResponse) GetUserId added in v1.3.0

func (x *LoginUserResponse) GetUserId() int64

func (*LoginUserResponse) ProtoMessage

func (*LoginUserResponse) ProtoMessage()

func (*LoginUserResponse) ProtoReflect

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

func (*LoginUserResponse) Reset

func (x *LoginUserResponse) Reset()

func (*LoginUserResponse) String

func (x *LoginUserResponse) String() string

func (*LoginUserResponse) Validate

func (m *LoginUserResponse) Validate() error

Validate checks the field values on LoginUserResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*LoginUserResponse) ValidateAll

func (m *LoginUserResponse) ValidateAll() error

ValidateAll checks the field values on LoginUserResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in LoginUserResponseMultiError, or nil if none found.

type LoginUserResponseMultiError

type LoginUserResponseMultiError []error

LoginUserResponseMultiError is an error wrapping multiple validation errors returned by LoginUserResponse.ValidateAll() if the designated constraints aren't met.

func (LoginUserResponseMultiError) AllErrors

func (m LoginUserResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (LoginUserResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type LoginUserResponseValidationError

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

LoginUserResponseValidationError is the validation error returned by LoginUserResponse.Validate if the designated constraints aren't met.

func (LoginUserResponseValidationError) Cause

Cause function returns cause value.

func (LoginUserResponseValidationError) Error

Error satisfies the builtin error interface

func (LoginUserResponseValidationError) ErrorName

ErrorName returns error name.

func (LoginUserResponseValidationError) Field

Field function returns field value.

func (LoginUserResponseValidationError) Key

Key function returns key value.

func (LoginUserResponseValidationError) Reason

Reason function returns reason value.

type RegisterUserRequest

type RegisterUserRequest struct {
	Email    string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*RegisterUserRequest) Descriptor deprecated

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

Deprecated: Use RegisterUserRequest.ProtoReflect.Descriptor instead.

func (*RegisterUserRequest) GetEmail

func (x *RegisterUserRequest) GetEmail() string

func (*RegisterUserRequest) GetPassword

func (x *RegisterUserRequest) GetPassword() string

func (*RegisterUserRequest) ProtoMessage

func (*RegisterUserRequest) ProtoMessage()

func (*RegisterUserRequest) ProtoReflect

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

func (*RegisterUserRequest) Reset

func (x *RegisterUserRequest) Reset()

func (*RegisterUserRequest) String

func (x *RegisterUserRequest) String() string

func (*RegisterUserRequest) Validate

func (m *RegisterUserRequest) Validate() error

Validate checks the field values on RegisterUserRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*RegisterUserRequest) ValidateAll

func (m *RegisterUserRequest) ValidateAll() error

ValidateAll checks the field values on RegisterUserRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RegisterUserRequestMultiError, or nil if none found.

type RegisterUserRequestMultiError

type RegisterUserRequestMultiError []error

RegisterUserRequestMultiError is an error wrapping multiple validation errors returned by RegisterUserRequest.ValidateAll() if the designated constraints aren't met.

func (RegisterUserRequestMultiError) AllErrors

func (m RegisterUserRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RegisterUserRequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type RegisterUserRequestValidationError

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

RegisterUserRequestValidationError is the validation error returned by RegisterUserRequest.Validate if the designated constraints aren't met.

func (RegisterUserRequestValidationError) Cause

Cause function returns cause value.

func (RegisterUserRequestValidationError) Error

Error satisfies the builtin error interface

func (RegisterUserRequestValidationError) ErrorName

ErrorName returns error name.

func (RegisterUserRequestValidationError) Field

Field function returns field value.

func (RegisterUserRequestValidationError) Key

Key function returns key value.

func (RegisterUserRequestValidationError) Reason

Reason function returns reason value.

type RegisterUserResponse

type RegisterUserResponse struct {
	UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// contains filtered or unexported fields
}

func (*RegisterUserResponse) Descriptor deprecated

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

Deprecated: Use RegisterUserResponse.ProtoReflect.Descriptor instead.

func (*RegisterUserResponse) GetUserId

func (x *RegisterUserResponse) GetUserId() int64

func (*RegisterUserResponse) ProtoMessage

func (*RegisterUserResponse) ProtoMessage()

func (*RegisterUserResponse) ProtoReflect

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

func (*RegisterUserResponse) Reset

func (x *RegisterUserResponse) Reset()

func (*RegisterUserResponse) String

func (x *RegisterUserResponse) String() string

func (*RegisterUserResponse) Validate

func (m *RegisterUserResponse) Validate() error

Validate checks the field values on RegisterUserResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*RegisterUserResponse) ValidateAll

func (m *RegisterUserResponse) ValidateAll() error

ValidateAll checks the field values on RegisterUserResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RegisterUserResponseMultiError, or nil if none found.

type RegisterUserResponseMultiError

type RegisterUserResponseMultiError []error

RegisterUserResponseMultiError is an error wrapping multiple validation errors returned by RegisterUserResponse.ValidateAll() if the designated constraints aren't met.

func (RegisterUserResponseMultiError) AllErrors

func (m RegisterUserResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RegisterUserResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type RegisterUserResponseValidationError

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

RegisterUserResponseValidationError is the validation error returned by RegisterUserResponse.Validate if the designated constraints aren't met.

func (RegisterUserResponseValidationError) Cause

Cause function returns cause value.

func (RegisterUserResponseValidationError) Error

Error satisfies the builtin error interface

func (RegisterUserResponseValidationError) ErrorName

ErrorName returns error name.

func (RegisterUserResponseValidationError) Field

Field function returns field value.

func (RegisterUserResponseValidationError) Key

Key function returns key value.

func (RegisterUserResponseValidationError) Reason

Reason function returns reason value.

type SSOClient

type SSOClient interface {
	RegisterUser(ctx context.Context, in *RegisterUserRequest, opts ...grpc.CallOption) (*RegisterUserResponse, error)
	LoginUser(ctx context.Context, in *LoginUserRequest, opts ...grpc.CallOption) (*LoginUserResponse, error)
	VerifyToken(ctx context.Context, in *VerifyTokenRequest, opts ...grpc.CallOption) (*VerifyTokenResponse, error)
}

SSOClient is the client API for SSO 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.

func NewSSOClient

func NewSSOClient(cc grpc.ClientConnInterface) SSOClient

type SSOServer

type SSOServer interface {
	RegisterUser(context.Context, *RegisterUserRequest) (*RegisterUserResponse, error)
	LoginUser(context.Context, *LoginUserRequest) (*LoginUserResponse, error)
	VerifyToken(context.Context, *VerifyTokenRequest) (*VerifyTokenResponse, error)
	// contains filtered or unexported methods
}

SSOServer is the server API for SSO service. All implementations must embed UnimplementedSSOServer for forward compatibility.

type UnimplementedSSOServer

type UnimplementedSSOServer struct{}

UnimplementedSSOServer must 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.

func (UnimplementedSSOServer) LoginUser

func (UnimplementedSSOServer) RegisterUser

func (UnimplementedSSOServer) VerifyToken

type UnsafeSSOServer

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

UnsafeSSOServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SSOServer will result in compilation errors.

type VerifyTokenRequest added in v1.4.0

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

func (*VerifyTokenRequest) Descriptor deprecated added in v1.4.0

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

Deprecated: Use VerifyTokenRequest.ProtoReflect.Descriptor instead.

func (*VerifyTokenRequest) GetToken added in v1.4.0

func (x *VerifyTokenRequest) GetToken() string

func (*VerifyTokenRequest) ProtoMessage added in v1.4.0

func (*VerifyTokenRequest) ProtoMessage()

func (*VerifyTokenRequest) ProtoReflect added in v1.4.0

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

func (*VerifyTokenRequest) Reset added in v1.4.0

func (x *VerifyTokenRequest) Reset()

func (*VerifyTokenRequest) String added in v1.4.0

func (x *VerifyTokenRequest) String() string

func (*VerifyTokenRequest) Validate added in v1.4.0

func (m *VerifyTokenRequest) Validate() error

Validate checks the field values on VerifyTokenRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*VerifyTokenRequest) ValidateAll added in v1.4.0

func (m *VerifyTokenRequest) ValidateAll() error

ValidateAll checks the field values on VerifyTokenRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in VerifyTokenRequestMultiError, or nil if none found.

type VerifyTokenRequestMultiError added in v1.4.0

type VerifyTokenRequestMultiError []error

VerifyTokenRequestMultiError is an error wrapping multiple validation errors returned by VerifyTokenRequest.ValidateAll() if the designated constraints aren't met.

func (VerifyTokenRequestMultiError) AllErrors added in v1.4.0

func (m VerifyTokenRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (VerifyTokenRequestMultiError) Error added in v1.4.0

Error returns a concatenation of all the error messages it wraps.

type VerifyTokenRequestValidationError added in v1.4.0

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

VerifyTokenRequestValidationError is the validation error returned by VerifyTokenRequest.Validate if the designated constraints aren't met.

func (VerifyTokenRequestValidationError) Cause added in v1.4.0

Cause function returns cause value.

func (VerifyTokenRequestValidationError) Error added in v1.4.0

Error satisfies the builtin error interface

func (VerifyTokenRequestValidationError) ErrorName added in v1.4.0

ErrorName returns error name.

func (VerifyTokenRequestValidationError) Field added in v1.4.0

Field function returns field value.

func (VerifyTokenRequestValidationError) Key added in v1.4.0

Key function returns key value.

func (VerifyTokenRequestValidationError) Reason added in v1.4.0

Reason function returns reason value.

type VerifyTokenResponse

type VerifyTokenResponse struct {
	UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// contains filtered or unexported fields
}

func (*VerifyTokenResponse) Descriptor deprecated

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

Deprecated: Use VerifyTokenResponse.ProtoReflect.Descriptor instead.

func (*VerifyTokenResponse) GetUserId

func (x *VerifyTokenResponse) GetUserId() int64

func (*VerifyTokenResponse) ProtoMessage

func (*VerifyTokenResponse) ProtoMessage()

func (*VerifyTokenResponse) ProtoReflect

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

func (*VerifyTokenResponse) Reset

func (x *VerifyTokenResponse) Reset()

func (*VerifyTokenResponse) String

func (x *VerifyTokenResponse) String() string

func (*VerifyTokenResponse) Validate

func (m *VerifyTokenResponse) Validate() error

Validate checks the field values on VerifyTokenResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*VerifyTokenResponse) ValidateAll

func (m *VerifyTokenResponse) ValidateAll() error

ValidateAll checks the field values on VerifyTokenResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in VerifyTokenResponseMultiError, or nil if none found.

type VerifyTokenResponseMultiError

type VerifyTokenResponseMultiError []error

VerifyTokenResponseMultiError is an error wrapping multiple validation errors returned by VerifyTokenResponse.ValidateAll() if the designated constraints aren't met.

func (VerifyTokenResponseMultiError) AllErrors

func (m VerifyTokenResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (VerifyTokenResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type VerifyTokenResponseValidationError

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

VerifyTokenResponseValidationError is the validation error returned by VerifyTokenResponse.Validate if the designated constraints aren't met.

func (VerifyTokenResponseValidationError) Cause

Cause function returns cause value.

func (VerifyTokenResponseValidationError) Error

Error satisfies the builtin error interface

func (VerifyTokenResponseValidationError) ErrorName

ErrorName returns error name.

func (VerifyTokenResponseValidationError) Field

Field function returns field value.

func (VerifyTokenResponseValidationError) Key

Key function returns key value.

func (VerifyTokenResponseValidationError) Reason

Reason function returns reason value.

Jump to

Keyboard shortcuts

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