auth

package
v0.0.0-...-a11f1b2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package auth is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	UserStorage_Auth_FullMethodName     = "/auth.UserStorage/auth"
	UserStorage_Register_FullMethodName = "/auth.UserStorage/register"
)

Variables

View Source
var File_auth_user_proto protoreflect.FileDescriptor
View Source
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 Builder

type Builder interface {
	Build() *Server
}

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
}

func (*Server) Auth

func (s *Server) Auth(ctx context.Context, cred *Credentials) (*Session, error)

func (*Server) Register

func (s *Server) Register(ctx context.Context, user *User) (*UserId, error)

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) Descriptor() ([]byte, []int)

Deprecated: Use Session.ProtoReflect.Descriptor instead.

func (*Session) GetToken

func (x *Session) GetToken() string

func (*Session) ProtoMessage

func (*Session) ProtoMessage()

func (*Session) ProtoReflect

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

func (*Session) Reset

func (x *Session) Reset()

func (*Session) String

func (x *Session) String() string

type UnimplementedUserStorageServer

type UnimplementedUserStorageServer struct {
}

UnimplementedUserStorageServer must be embedded to have forward compatible implementations.

func (UnimplementedUserStorageServer) Auth

func (UnimplementedUserStorageServer) Register

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) Descriptor() ([]byte, []int)

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetPassword

func (x *User) GetPassword() string

func (*User) GetUsername

func (x *User) GetUsername() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use UserId.ProtoReflect.Descriptor instead.

func (*UserId) GetId

func (x *UserId) GetId() uint32

func (*UserId) ProtoMessage

func (*UserId) ProtoMessage()

func (*UserId) ProtoReflect

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

func (*UserId) Reset

func (x *UserId) Reset()

func (*UserId) String

func (x *UserId) String() string

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.

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

Jump to

Keyboard shortcuts

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