session

package
v2.9.15 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 18

Documentation

Overview

Package session is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthSession        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSession          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupSession = fmt.Errorf("proto: unexpected end of group")
)

Functions

func RegisterSessionServiceHandler

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

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

func RegisterSessionServiceHandlerClient

func RegisterSessionServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SessionServiceClient) error

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

func RegisterSessionServiceHandlerFromEndpoint

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

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

func RegisterSessionServiceHandlerServer

func RegisterSessionServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SessionServiceServer) error

RegisterSessionServiceHandlerServer registers the http handlers for service SessionService to "mux". UnaryRPC :call SessionServiceServer 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 RegisterSessionServiceHandlerFromEndpoint instead.

func RegisterSessionServiceServer

func RegisterSessionServiceServer(s *grpc.Server, srv SessionServiceServer)

Types

type GetUserInfoRequest

type GetUserInfoRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Get the current user's userInfo info

func (*GetUserInfoRequest) Descriptor

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

func (*GetUserInfoRequest) Marshal

func (m *GetUserInfoRequest) Marshal() (dAtA []byte, err error)

func (*GetUserInfoRequest) MarshalTo

func (m *GetUserInfoRequest) MarshalTo(dAtA []byte) (int, error)

func (*GetUserInfoRequest) MarshalToSizedBuffer

func (m *GetUserInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetUserInfoRequest) ProtoMessage

func (*GetUserInfoRequest) ProtoMessage()

func (*GetUserInfoRequest) Reset

func (m *GetUserInfoRequest) Reset()

func (*GetUserInfoRequest) Size

func (m *GetUserInfoRequest) Size() (n int)

func (*GetUserInfoRequest) String

func (m *GetUserInfoRequest) String() string

func (*GetUserInfoRequest) Unmarshal

func (m *GetUserInfoRequest) Unmarshal(dAtA []byte) error

func (*GetUserInfoRequest) XXX_DiscardUnknown

func (m *GetUserInfoRequest) XXX_DiscardUnknown()

func (*GetUserInfoRequest) XXX_Marshal

func (m *GetUserInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetUserInfoRequest) XXX_Merge

func (m *GetUserInfoRequest) XXX_Merge(src proto.Message)

func (*GetUserInfoRequest) XXX_Size

func (m *GetUserInfoRequest) XXX_Size() int

func (*GetUserInfoRequest) XXX_Unmarshal

func (m *GetUserInfoRequest) XXX_Unmarshal(b []byte) error

type GetUserInfoResponse

type GetUserInfoResponse struct {
	LoggedIn             bool     `protobuf:"varint,1,opt,name=loggedIn,proto3" json:"loggedIn,omitempty"`
	Username             string   `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
	Iss                  string   `protobuf:"bytes,3,opt,name=iss,proto3" json:"iss,omitempty"`
	Groups               []string `protobuf:"bytes,4,rep,name=groups,proto3" json:"groups,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

The current user's userInfo info

func (*GetUserInfoResponse) Descriptor

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

func (*GetUserInfoResponse) GetGroups

func (m *GetUserInfoResponse) GetGroups() []string

func (*GetUserInfoResponse) GetIss

func (m *GetUserInfoResponse) GetIss() string

func (*GetUserInfoResponse) GetLoggedIn

func (m *GetUserInfoResponse) GetLoggedIn() bool

func (*GetUserInfoResponse) GetUsername

func (m *GetUserInfoResponse) GetUsername() string

func (*GetUserInfoResponse) Marshal

func (m *GetUserInfoResponse) Marshal() (dAtA []byte, err error)

func (*GetUserInfoResponse) MarshalTo

func (m *GetUserInfoResponse) MarshalTo(dAtA []byte) (int, error)

func (*GetUserInfoResponse) MarshalToSizedBuffer

func (m *GetUserInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetUserInfoResponse) ProtoMessage

func (*GetUserInfoResponse) ProtoMessage()

func (*GetUserInfoResponse) Reset

func (m *GetUserInfoResponse) Reset()

func (*GetUserInfoResponse) Size

func (m *GetUserInfoResponse) Size() (n int)

func (*GetUserInfoResponse) String

func (m *GetUserInfoResponse) String() string

func (*GetUserInfoResponse) Unmarshal

func (m *GetUserInfoResponse) Unmarshal(dAtA []byte) error

func (*GetUserInfoResponse) XXX_DiscardUnknown

func (m *GetUserInfoResponse) XXX_DiscardUnknown()

func (*GetUserInfoResponse) XXX_Marshal

func (m *GetUserInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetUserInfoResponse) XXX_Merge

func (m *GetUserInfoResponse) XXX_Merge(src proto.Message)

func (*GetUserInfoResponse) XXX_Size

func (m *GetUserInfoResponse) XXX_Size() int

func (*GetUserInfoResponse) XXX_Unmarshal

func (m *GetUserInfoResponse) XXX_Unmarshal(b []byte) error

type SessionCreateRequest

type SessionCreateRequest struct {
	Username             string   `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Password             string   `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	Token                string   `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

SessionCreateRequest is for logging in.

func (*SessionCreateRequest) Descriptor

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

func (*SessionCreateRequest) GetPassword

func (m *SessionCreateRequest) GetPassword() string

func (*SessionCreateRequest) GetToken

func (m *SessionCreateRequest) GetToken() string

func (*SessionCreateRequest) GetUsername

func (m *SessionCreateRequest) GetUsername() string

func (*SessionCreateRequest) Marshal

func (m *SessionCreateRequest) Marshal() (dAtA []byte, err error)

func (*SessionCreateRequest) MarshalTo

func (m *SessionCreateRequest) MarshalTo(dAtA []byte) (int, error)

func (*SessionCreateRequest) MarshalToSizedBuffer

func (m *SessionCreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SessionCreateRequest) ProtoMessage

func (*SessionCreateRequest) ProtoMessage()

func (*SessionCreateRequest) Reset

func (m *SessionCreateRequest) Reset()

func (*SessionCreateRequest) Size

func (m *SessionCreateRequest) Size() (n int)

func (*SessionCreateRequest) String

func (m *SessionCreateRequest) String() string

func (*SessionCreateRequest) Unmarshal

func (m *SessionCreateRequest) Unmarshal(dAtA []byte) error

func (*SessionCreateRequest) XXX_DiscardUnknown

func (m *SessionCreateRequest) XXX_DiscardUnknown()

func (*SessionCreateRequest) XXX_Marshal

func (m *SessionCreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SessionCreateRequest) XXX_Merge

func (m *SessionCreateRequest) XXX_Merge(src proto.Message)

func (*SessionCreateRequest) XXX_Size

func (m *SessionCreateRequest) XXX_Size() int

func (*SessionCreateRequest) XXX_Unmarshal

func (m *SessionCreateRequest) XXX_Unmarshal(b []byte) error

type SessionDeleteRequest

type SessionDeleteRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

SessionDeleteRequest is for logging out.

func (*SessionDeleteRequest) Descriptor

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

func (*SessionDeleteRequest) Marshal

func (m *SessionDeleteRequest) Marshal() (dAtA []byte, err error)

func (*SessionDeleteRequest) MarshalTo

func (m *SessionDeleteRequest) MarshalTo(dAtA []byte) (int, error)

func (*SessionDeleteRequest) MarshalToSizedBuffer

func (m *SessionDeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SessionDeleteRequest) ProtoMessage

func (*SessionDeleteRequest) ProtoMessage()

func (*SessionDeleteRequest) Reset

func (m *SessionDeleteRequest) Reset()

func (*SessionDeleteRequest) Size

func (m *SessionDeleteRequest) Size() (n int)

func (*SessionDeleteRequest) String

func (m *SessionDeleteRequest) String() string

func (*SessionDeleteRequest) Unmarshal

func (m *SessionDeleteRequest) Unmarshal(dAtA []byte) error

func (*SessionDeleteRequest) XXX_DiscardUnknown

func (m *SessionDeleteRequest) XXX_DiscardUnknown()

func (*SessionDeleteRequest) XXX_Marshal

func (m *SessionDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SessionDeleteRequest) XXX_Merge

func (m *SessionDeleteRequest) XXX_Merge(src proto.Message)

func (*SessionDeleteRequest) XXX_Size

func (m *SessionDeleteRequest) XXX_Size() int

func (*SessionDeleteRequest) XXX_Unmarshal

func (m *SessionDeleteRequest) XXX_Unmarshal(b []byte) error

type SessionResponse

type SessionResponse struct {
	Token                string   `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

SessionResponse wraps the created token or returns an empty string if deleted.

func (*SessionResponse) Descriptor

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

func (*SessionResponse) GetToken

func (m *SessionResponse) GetToken() string

func (*SessionResponse) Marshal

func (m *SessionResponse) Marshal() (dAtA []byte, err error)

func (*SessionResponse) MarshalTo

func (m *SessionResponse) MarshalTo(dAtA []byte) (int, error)

func (*SessionResponse) MarshalToSizedBuffer

func (m *SessionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SessionResponse) ProtoMessage

func (*SessionResponse) ProtoMessage()

func (*SessionResponse) Reset

func (m *SessionResponse) Reset()

func (*SessionResponse) Size

func (m *SessionResponse) Size() (n int)

func (*SessionResponse) String

func (m *SessionResponse) String() string

func (*SessionResponse) Unmarshal

func (m *SessionResponse) Unmarshal(dAtA []byte) error

func (*SessionResponse) XXX_DiscardUnknown

func (m *SessionResponse) XXX_DiscardUnknown()

func (*SessionResponse) XXX_Marshal

func (m *SessionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SessionResponse) XXX_Merge

func (m *SessionResponse) XXX_Merge(src proto.Message)

func (*SessionResponse) XXX_Size

func (m *SessionResponse) XXX_Size() int

func (*SessionResponse) XXX_Unmarshal

func (m *SessionResponse) XXX_Unmarshal(b []byte) error

type SessionServiceClient

type SessionServiceClient interface {
	// Get the current user's info
	GetUserInfo(ctx context.Context, in *GetUserInfoRequest, opts ...grpc.CallOption) (*GetUserInfoResponse, error)
	// Create a new JWT for authentication and set a cookie if using HTTP
	Create(ctx context.Context, in *SessionCreateRequest, opts ...grpc.CallOption) (*SessionResponse, error)
	// Delete an existing JWT cookie if using HTTP
	Delete(ctx context.Context, in *SessionDeleteRequest, opts ...grpc.CallOption) (*SessionResponse, error)
}

SessionServiceClient is the client API for SessionService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewSessionServiceClient

func NewSessionServiceClient(cc *grpc.ClientConn) SessionServiceClient

type SessionServiceServer

type SessionServiceServer interface {
	// Get the current user's info
	GetUserInfo(context.Context, *GetUserInfoRequest) (*GetUserInfoResponse, error)
	// Create a new JWT for authentication and set a cookie if using HTTP
	Create(context.Context, *SessionCreateRequest) (*SessionResponse, error)
	// Delete an existing JWT cookie if using HTTP
	Delete(context.Context, *SessionDeleteRequest) (*SessionResponse, error)
}

SessionServiceServer is the server API for SessionService service.

type UnimplementedSessionServiceServer

type UnimplementedSessionServiceServer struct {
}

UnimplementedSessionServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedSessionServiceServer) Create

func (*UnimplementedSessionServiceServer) Delete

func (*UnimplementedSessionServiceServer) GetUserInfo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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