Documentation ¶
Overview ¶
Package auth is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterUserStorageHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUserStorageHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserStorageClient) error
- func RegisterUserStorageHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUserStorageHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserStorageServer) error
- func RegisterUserStorageServer(s grpc.ServiceRegistrar, srv UserStorageServer)
- type Builder
- type Credentials
- func (*Credentials) Descriptor() ([]byte, []int)deprecated
- func (x *Credentials) GetEmail() string
- func (x *Credentials) GetPassword() string
- func (*Credentials) ProtoMessage()
- func (x *Credentials) ProtoReflect() protoreflect.Message
- func (x *Credentials) Reset()
- func (x *Credentials) String() string
- type Server
- type ServerBuilder
- type Session
- type UnimplementedUserStorageServer
- type UnsafeUserStorageServer
- type User
- type UserId
- type UserStorageClient
- type UserStorageServer
Constants ¶
const ( UserStorage_Auth_FullMethodName = "/auth.UserStorage/auth" UserStorage_Register_FullMethodName = "/auth.UserStorage/register" )
Variables ¶
var File_auth_user_proto protoreflect.FileDescriptor
var UserStorage_ServiceDesc = grpc.ServiceDesc{ ServiceName: "auth.UserStorage", HandlerType: (*UserStorageServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "auth", Handler: _UserStorage_Auth_Handler, }, { MethodName: "register", Handler: _UserStorage_Register_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "auth/user.proto", }
UserStorage_ServiceDesc is the grpc.ServiceDesc for UserStorage service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterUserStorageHandler ¶
func RegisterUserStorageHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterUserStorageHandler registers the http handlers for service UserStorage to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserStorageHandlerClient ¶
func RegisterUserStorageHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserStorageClient) error
RegisterUserStorageHandlerClient registers the http handlers for service UserStorage to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserStorageClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserStorageClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserStorageClient" to call the correct interceptors.
func RegisterUserStorageHandlerFromEndpoint ¶
func RegisterUserStorageHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUserStorageHandlerFromEndpoint is same as RegisterUserStorageHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserStorageHandlerServer ¶
func RegisterUserStorageHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserStorageServer) error
RegisterUserStorageHandlerServer registers the http handlers for service UserStorage to "mux". UnaryRPC :call UserStorageServer 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 RegisterUserStorageHandlerFromEndpoint instead.
func RegisterUserStorageServer ¶
func RegisterUserStorageServer(s grpc.ServiceRegistrar, srv UserStorageServer)
Types ¶
type Credentials ¶
type Credentials 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 (*Credentials) Descriptor
deprecated
func (*Credentials) Descriptor() ([]byte, []int)
Deprecated: Use Credentials.ProtoReflect.Descriptor instead.
func (*Credentials) GetEmail ¶
func (x *Credentials) GetEmail() string
func (*Credentials) GetPassword ¶
func (x *Credentials) GetPassword() string
func (*Credentials) ProtoMessage ¶
func (*Credentials) ProtoMessage()
func (*Credentials) ProtoReflect ¶
func (x *Credentials) ProtoReflect() protoreflect.Message
func (*Credentials) Reset ¶
func (x *Credentials) Reset()
func (*Credentials) String ¶
func (x *Credentials) String() string
type Server ¶
type Server struct { UserStorageServer // contains filtered or unexported fields }
type ServerBuilder ¶
type ServerBuilder struct {
Server Server
}
func (*ServerBuilder) Build ¶
func (b *ServerBuilder) Build() *Server
func (*ServerBuilder) ConfigureIdentifier ¶
func (b *ServerBuilder) ConfigureIdentifier(identifier data.Identifier)
func (*ServerBuilder) ConfigureLogger ¶
func (b *ServerBuilder) ConfigureLogger(l *log.Logger)
func (*ServerBuilder) ConfigureRegistrar ¶
func (b *ServerBuilder) ConfigureRegistrar(registrar data.Registrar)
func (*ServerBuilder) ConfigureSession ¶
func (b *ServerBuilder) ConfigureSession(s session.Session)
type Session ¶
type Session struct { Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` // contains filtered or unexported fields }
func (*Session) Descriptor
deprecated
func (*Session) ProtoMessage ¶
func (*Session) ProtoMessage()
func (*Session) ProtoReflect ¶
func (x *Session) ProtoReflect() protoreflect.Message
type UnimplementedUserStorageServer ¶
type UnimplementedUserStorageServer struct { }
UnimplementedUserStorageServer must be embedded to have forward compatible implementations.
func (UnimplementedUserStorageServer) Auth ¶
func (UnimplementedUserStorageServer) Auth(context.Context, *Credentials) (*Session, error)
type UnsafeUserStorageServer ¶
type UnsafeUserStorageServer interface {
// contains filtered or unexported methods
}
UnsafeUserStorageServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UserStorageServer will result in compilation errors.
type User ¶
type User 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"` Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` // contains filtered or unexported fields }
func (*User) Descriptor
deprecated
func (*User) GetPassword ¶
func (*User) GetUsername ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type UserId ¶
type UserId struct { Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*UserId) Descriptor
deprecated
func (*UserId) ProtoMessage ¶
func (*UserId) ProtoMessage()
func (*UserId) ProtoReflect ¶
func (x *UserId) ProtoReflect() protoreflect.Message
type UserStorageClient ¶
type UserStorageClient interface { Auth(ctx context.Context, in *Credentials, opts ...grpc.CallOption) (*Session, error) Register(ctx context.Context, in *User, opts ...grpc.CallOption) (*UserId, error) }
UserStorageClient is the client API for UserStorage 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 NewUserStorageClient ¶
func NewUserStorageClient(cc grpc.ClientConnInterface) UserStorageClient
type UserStorageServer ¶
type UserStorageServer interface { Auth(context.Context, *Credentials) (*Session, error) Register(context.Context, *User) (*UserId, error) // contains filtered or unexported methods }
UserStorageServer is the server API for UserStorage service. All implementations must embed UnimplementedUserStorageServer for forward compatibility