users

package
v0.0.0-...-3fa0f1d Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_users_users_proto protoreflect.FileDescriptor
View Source
var Users_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "users.Users",
	HandlerType: (*UsersServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Register",
			Handler:    _Users_Register_Handler,
		},
		{
			MethodName: "Authenticate",
			Handler:    _Users_Authenticate_Handler,
		},
		{
			MethodName: "Authorize",
			Handler:    _Users_Authorize_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "users/users.proto",
}

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

Functions

func RegisterUsersServer

func RegisterUsersServer(s grpc.ServiceRegistrar, srv UsersServer)

Types

type Session

type Session struct {

	// The user id reffered to in this session.
	Id *UserId `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// The token assigned to this session.
	Token *Token `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	// The time the session will expire.
	Expires int64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"`
	// contains filtered or unexported fields
}

Session represents the encoded authorization of a user that has successfully completed the authentication process.

func (*Session) Descriptor deprecated

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

Deprecated: Use Session.ProtoReflect.Descriptor instead.

func (*Session) GetExpires

func (x *Session) GetExpires() int64

func (*Session) GetId

func (x *Session) GetId() *UserId

func (*Session) GetToken

func (x *Session) GetToken() *Token

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 Token

type Token struct {

	// THe string encoded value of the token.
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

Token represents a randomly generated token that is provided to the user for them to provide to other services to authorize.

func (*Token) Descriptor deprecated

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

Deprecated: Use Token.ProtoReflect.Descriptor instead.

func (*Token) GetValue

func (x *Token) GetValue() string

func (*Token) ProtoMessage

func (*Token) ProtoMessage()

func (*Token) ProtoReflect

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

func (*Token) Reset

func (x *Token) Reset()

func (*Token) String

func (x *Token) String() string

type UnimplementedUsersServer

type UnimplementedUsersServer struct {
}

UnimplementedUsersServer must be embedded to have forward compatible implementations.

func (UnimplementedUsersServer) Authenticate

func (UnimplementedUsersServer) Authorize

func (UnimplementedUsersServer) Register

type UnsafeUsersServer

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

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

type UserId

type UserId struct {

	// The string encoded value of the user id.
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

UserId represents the identity of the user account.

func (*UserId) Descriptor deprecated

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

Deprecated: Use UserId.ProtoReflect.Descriptor instead.

func (*UserId) GetValue

func (x *UserId) GetValue() string

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 UserInfo

type UserInfo struct {

	// The id of the user.
	Id *UserId `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// The encoded role names assigned to the user.
	Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"`
	// contains filtered or unexported fields
}

UserInfo stores data about the user that can be provided to other services.

func (*UserInfo) Descriptor deprecated

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

Deprecated: Use UserInfo.ProtoReflect.Descriptor instead.

func (*UserInfo) GetId

func (x *UserInfo) GetId() *UserId

func (*UserInfo) GetRoles

func (x *UserInfo) GetRoles() []string

func (*UserInfo) ProtoMessage

func (*UserInfo) ProtoMessage()

func (*UserInfo) ProtoReflect

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

func (*UserInfo) Reset

func (x *UserInfo) Reset()

func (*UserInfo) String

func (x *UserInfo) String() string

type UserPII

type UserPII struct {

	// The unique name of the user.
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	// The raw password value.
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

UserPII represents the users personal identifying information. This includes their username, password, and email address.

func (*UserPII) Descriptor deprecated

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

Deprecated: Use UserPII.ProtoReflect.Descriptor instead.

func (*UserPII) GetPassword

func (x *UserPII) GetPassword() string

func (*UserPII) GetUsername

func (x *UserPII) GetUsername() string

func (*UserPII) ProtoMessage

func (*UserPII) ProtoMessage()

func (*UserPII) ProtoReflect

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

func (*UserPII) Reset

func (x *UserPII) Reset()

func (*UserPII) String

func (x *UserPII) String() string

type UsersClient

type UsersClient interface {
	// Register allows a new user to register an account
	// by providing their personal identifying information.
	Register(ctx context.Context, in *UserPII, opts ...grpc.CallOption) (*UserId, error)
	// Authenticate allows an existing user to access services
	// by providing their personal identifying information.
	Authenticate(ctx context.Context, in *UserPII, opts ...grpc.CallOption) (*Session, error)
	// Authorize allows external services to access information
	// about an authenticated user by the token provided to the
	// user during the authentication process.
	Authorize(ctx context.Context, in *Token, opts ...grpc.CallOption) (*UserInfo, error)
}

UsersClient is the client API for Users 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 NewUsersClient

func NewUsersClient(cc grpc.ClientConnInterface) UsersClient

type UsersServer

type UsersServer interface {
	// Register allows a new user to register an account
	// by providing their personal identifying information.
	Register(context.Context, *UserPII) (*UserId, error)
	// Authenticate allows an existing user to access services
	// by providing their personal identifying information.
	Authenticate(context.Context, *UserPII) (*Session, error)
	// Authorize allows external services to access information
	// about an authenticated user by the token provided to the
	// user during the authentication process.
	Authorize(context.Context, *Token) (*UserInfo, error)
	// contains filtered or unexported methods
}

UsersServer is the server API for Users service. All implementations must embed UnimplementedUsersServer for forward compatibility

Jump to

Keyboard shortcuts

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