sessions

package
v0.0.0-...-f5cdc36 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_app_sessions_session_proto protoreflect.FileDescriptor

Functions

func RegisterAuthorizationServiceServer

func RegisterAuthorizationServiceServer(s *grpc.Server, srv AuthorizationServiceServer)

Types

type Application

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

func NewApplication

func NewApplication(logger logger.Logger, cfg *config.Config, redisConn *redis.Client, tracer opentracing.Tracer) Application

func (*Application) Run

func (s *Application) Run() error

type AuthorizationServiceClient

type AuthorizationServiceClient interface {
	CreateSession(ctx context.Context, in *CreateSessionRequest, opts ...grpc.CallOption) (*CreateSessionResponse, error)
	GetSessionByID(ctx context.Context, in *GetSessionByIDRequest, opts ...grpc.CallOption) (*GetSessionByIDResponse, error)
	DeleteSession(ctx context.Context, in *DeleteSessionRequest, opts ...grpc.CallOption) (*DeleteSessionResponse, error)
	CreateCsrfToken(ctx context.Context, in *CreateCsrfTokenRequest, opts ...grpc.CallOption) (*CreateCsrfTokenResponse, error)
	CheckCsrfToken(ctx context.Context, in *CheckCsrfTokenRequest, opts ...grpc.CallOption) (*CheckCsrfTokenResponse, error)
}

AuthorizationServiceClient is the client API for AuthorizationService service.

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

type AuthorizationServiceServer

AuthorizationServiceServer is the server API for AuthorizationService service.

type CSRFRepository

type CSRFRepository interface {
	Create(ctx context.Context, token string) error
	GetToken(ctx context.Context, token string) (string, error)
}

type CSRFService

type CSRFService interface {
	GetCSRFToken(ctx context.Context, sesID string) (string, error)
	ValidateCSRFToken(ctx context.Context, sesID string, token string) (bool, error)
}

type CheckCsrfTokenRequest

type CheckCsrfTokenRequest struct {
	CsrfTokenCheck *CsrfTokenCheck `protobuf:"bytes,1,opt,name=CsrfTokenCheck,proto3" json:"CsrfTokenCheck,omitempty"`
	// contains filtered or unexported fields
}

func (*CheckCsrfTokenRequest) Descriptor deprecated

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

Deprecated: Use CheckCsrfTokenRequest.ProtoReflect.Descriptor instead.

func (*CheckCsrfTokenRequest) GetCsrfTokenCheck

func (x *CheckCsrfTokenRequest) GetCsrfTokenCheck() *CsrfTokenCheck

func (*CheckCsrfTokenRequest) ProtoMessage

func (*CheckCsrfTokenRequest) ProtoMessage()

func (*CheckCsrfTokenRequest) ProtoReflect

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

func (*CheckCsrfTokenRequest) Reset

func (x *CheckCsrfTokenRequest) Reset()

func (*CheckCsrfTokenRequest) String

func (x *CheckCsrfTokenRequest) String() string

type CheckCsrfTokenResponse

type CheckCsrfTokenResponse struct {
	CheckResult *CheckResult `protobuf:"bytes,1,opt,name=CheckResult,proto3" json:"CheckResult,omitempty"`
	// contains filtered or unexported fields
}

func (*CheckCsrfTokenResponse) Descriptor deprecated

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

Deprecated: Use CheckCsrfTokenResponse.ProtoReflect.Descriptor instead.

func (*CheckCsrfTokenResponse) GetCheckResult

func (x *CheckCsrfTokenResponse) GetCheckResult() *CheckResult

func (*CheckCsrfTokenResponse) ProtoMessage

func (*CheckCsrfTokenResponse) ProtoMessage()

func (*CheckCsrfTokenResponse) ProtoReflect

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

func (*CheckCsrfTokenResponse) Reset

func (x *CheckCsrfTokenResponse) Reset()

func (*CheckCsrfTokenResponse) String

func (x *CheckCsrfTokenResponse) String() string

type CheckResult

type CheckResult struct {
	Result bool `protobuf:"varint,1,opt,name=Result,proto3" json:"Result,omitempty"`
	// contains filtered or unexported fields
}

func (*CheckResult) Descriptor deprecated

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

Deprecated: Use CheckResult.ProtoReflect.Descriptor instead.

func (*CheckResult) GetResult

func (x *CheckResult) GetResult() bool

func (*CheckResult) ProtoMessage

func (*CheckResult) ProtoMessage()

func (*CheckResult) ProtoReflect

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

func (*CheckResult) Reset

func (x *CheckResult) Reset()

func (*CheckResult) String

func (x *CheckResult) String() string

type CreateCsrfTokenRequest

type CreateCsrfTokenRequest struct {
	CsrfTokenInput *CsrfTokenInput `protobuf:"bytes,1,opt,name=CsrfTokenInput,proto3" json:"CsrfTokenInput,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateCsrfTokenRequest) Descriptor deprecated

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

Deprecated: Use CreateCsrfTokenRequest.ProtoReflect.Descriptor instead.

func (*CreateCsrfTokenRequest) GetCsrfTokenInput

func (x *CreateCsrfTokenRequest) GetCsrfTokenInput() *CsrfTokenInput

func (*CreateCsrfTokenRequest) ProtoMessage

func (*CreateCsrfTokenRequest) ProtoMessage()

func (*CreateCsrfTokenRequest) ProtoReflect

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

func (*CreateCsrfTokenRequest) Reset

func (x *CreateCsrfTokenRequest) Reset()

func (*CreateCsrfTokenRequest) String

func (x *CreateCsrfTokenRequest) String() string

type CreateCsrfTokenResponse

type CreateCsrfTokenResponse struct {
	CsrfToken *CsrfToken `protobuf:"bytes,1,opt,name=CsrfToken,proto3" json:"CsrfToken,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateCsrfTokenResponse) Descriptor deprecated

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

Deprecated: Use CreateCsrfTokenResponse.ProtoReflect.Descriptor instead.

func (*CreateCsrfTokenResponse) GetCsrfToken

func (x *CreateCsrfTokenResponse) GetCsrfToken() *CsrfToken

func (*CreateCsrfTokenResponse) ProtoMessage

func (*CreateCsrfTokenResponse) ProtoMessage()

func (*CreateCsrfTokenResponse) ProtoReflect

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

func (*CreateCsrfTokenResponse) Reset

func (x *CreateCsrfTokenResponse) Reset()

func (*CreateCsrfTokenResponse) String

func (x *CreateCsrfTokenResponse) String() string

type CreateSessionRequest

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

func (*CreateSessionRequest) Descriptor deprecated

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

Deprecated: Use CreateSessionRequest.ProtoReflect.Descriptor instead.

func (*CreateSessionRequest) GetUserID

func (x *CreateSessionRequest) GetUserID() string

func (*CreateSessionRequest) ProtoMessage

func (*CreateSessionRequest) ProtoMessage()

func (*CreateSessionRequest) ProtoReflect

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

func (*CreateSessionRequest) Reset

func (x *CreateSessionRequest) Reset()

func (*CreateSessionRequest) String

func (x *CreateSessionRequest) String() string

type CreateSessionResponse

type CreateSessionResponse struct {
	Session *Session `protobuf:"bytes,1,opt,name=Session,proto3" json:"Session,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateSessionResponse) Descriptor deprecated

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

Deprecated: Use CreateSessionResponse.ProtoReflect.Descriptor instead.

func (*CreateSessionResponse) GetSession

func (x *CreateSessionResponse) GetSession() *Session

func (*CreateSessionResponse) ProtoMessage

func (*CreateSessionResponse) ProtoMessage()

func (*CreateSessionResponse) ProtoReflect

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

func (*CreateSessionResponse) Reset

func (x *CreateSessionResponse) Reset()

func (*CreateSessionResponse) String

func (x *CreateSessionResponse) String() string

type CsrfRepositoryImpl

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

func NewCSRFRepository

func NewCSRFRepository(redis *redis.Client, prefix string, duration time.Duration) CsrfRepositoryImpl

func (*CsrfRepositoryImpl) Create

func (r *CsrfRepositoryImpl) Create(ctx context.Context, token string) error

Create csrf token

func (*CsrfRepositoryImpl) GetToken

func (r *CsrfRepositoryImpl) GetToken(ctx context.Context, token string) (string, error)

Check csrf token

type CsrfServiceImpl

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

func NewCSRFService

func NewCSRFService(salt string, csrfRepo CSRFRepository) CsrfServiceImpl

func (*CsrfServiceImpl) GetCSRFToken

func (c *CsrfServiceImpl) GetCSRFToken(ctx context.Context, sesID string) (string, error)

func (*CsrfServiceImpl) ValidateCSRFToken

func (c *CsrfServiceImpl) ValidateCSRFToken(ctx context.Context, sesID string, token string) (bool, error)

type CsrfToken

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

func (*CsrfToken) Descriptor deprecated

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

Deprecated: Use CsrfToken.ProtoReflect.Descriptor instead.

func (*CsrfToken) GetToken

func (x *CsrfToken) GetToken() string

func (*CsrfToken) ProtoMessage

func (*CsrfToken) ProtoMessage()

func (*CsrfToken) ProtoReflect

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

func (*CsrfToken) Reset

func (x *CsrfToken) Reset()

func (*CsrfToken) String

func (x *CsrfToken) String() string

type CsrfTokenCheck

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

func (*CsrfTokenCheck) Descriptor deprecated

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

Deprecated: Use CsrfTokenCheck.ProtoReflect.Descriptor instead.

func (*CsrfTokenCheck) GetSessionID

func (x *CsrfTokenCheck) GetSessionID() string

func (*CsrfTokenCheck) GetToken

func (x *CsrfTokenCheck) GetToken() string

func (*CsrfTokenCheck) ProtoMessage

func (*CsrfTokenCheck) ProtoMessage()

func (*CsrfTokenCheck) ProtoReflect

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

func (*CsrfTokenCheck) Reset

func (x *CsrfTokenCheck) Reset()

func (*CsrfTokenCheck) String

func (x *CsrfTokenCheck) String() string

type CsrfTokenInput

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

func (*CsrfTokenInput) Descriptor deprecated

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

Deprecated: Use CsrfTokenInput.ProtoReflect.Descriptor instead.

func (*CsrfTokenInput) GetSessionID

func (x *CsrfTokenInput) GetSessionID() string

func (*CsrfTokenInput) ProtoMessage

func (*CsrfTokenInput) ProtoMessage()

func (*CsrfTokenInput) ProtoReflect

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

func (*CsrfTokenInput) Reset

func (x *CsrfTokenInput) Reset()

func (*CsrfTokenInput) String

func (x *CsrfTokenInput) String() string

type DeleteSessionRequest

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

func (*DeleteSessionRequest) Descriptor deprecated

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

Deprecated: Use DeleteSessionRequest.ProtoReflect.Descriptor instead.

func (*DeleteSessionRequest) GetSessionID

func (x *DeleteSessionRequest) GetSessionID() string

func (*DeleteSessionRequest) ProtoMessage

func (*DeleteSessionRequest) ProtoMessage()

func (*DeleteSessionRequest) ProtoReflect

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

func (*DeleteSessionRequest) Reset

func (x *DeleteSessionRequest) Reset()

func (*DeleteSessionRequest) String

func (x *DeleteSessionRequest) String() string

type DeleteSessionResponse

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

func (*DeleteSessionResponse) Descriptor deprecated

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

Deprecated: Use DeleteSessionResponse.ProtoReflect.Descriptor instead.

func (*DeleteSessionResponse) GetSessionID

func (x *DeleteSessionResponse) GetSessionID() string

func (*DeleteSessionResponse) ProtoMessage

func (*DeleteSessionResponse) ProtoMessage()

func (*DeleteSessionResponse) ProtoReflect

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

func (*DeleteSessionResponse) Reset

func (x *DeleteSessionResponse) Reset()

func (*DeleteSessionResponse) String

func (x *DeleteSessionResponse) String() string

type Empty

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

func (*Empty) Descriptor deprecated

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

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

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

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

type GetSessionByIDRequest

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

func (*GetSessionByIDRequest) Descriptor deprecated

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

Deprecated: Use GetSessionByIDRequest.ProtoReflect.Descriptor instead.

func (*GetSessionByIDRequest) GetSessionID

func (x *GetSessionByIDRequest) GetSessionID() string

func (*GetSessionByIDRequest) ProtoMessage

func (*GetSessionByIDRequest) ProtoMessage()

func (*GetSessionByIDRequest) ProtoReflect

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

func (*GetSessionByIDRequest) Reset

func (x *GetSessionByIDRequest) Reset()

func (*GetSessionByIDRequest) String

func (x *GetSessionByIDRequest) String() string

type GetSessionByIDResponse

type GetSessionByIDResponse struct {
	Session *Session `protobuf:"bytes,1,opt,name=Session,proto3" json:"Session,omitempty"`
	// contains filtered or unexported fields
}

func (*GetSessionByIDResponse) Descriptor deprecated

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

Deprecated: Use GetSessionByIDResponse.ProtoReflect.Descriptor instead.

func (*GetSessionByIDResponse) GetSession

func (x *GetSessionByIDResponse) GetSession() *Session

func (*GetSessionByIDResponse) ProtoMessage

func (*GetSessionByIDResponse) ProtoMessage()

func (*GetSessionByIDResponse) ProtoReflect

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

func (*GetSessionByIDResponse) Reset

func (x *GetSessionByIDResponse) Reset()

func (*GetSessionByIDResponse) String

func (x *GetSessionByIDResponse) String() string

type Repository

type Repository interface {
	CreateSession(ctx context.Context, userID uuid.UUID) (*SessionDO, error)
	GetSessionByID(ctx context.Context, sessID string) (*SessionDO, error)
	DeleteSession(ctx context.Context, sessID string) error
}

type RepositoryImpl

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

func NewRepository

func NewRepository(redis *redis.Client, prefix string, expiration time.Duration) RepositoryImpl

func (*RepositoryImpl) CreateSession

func (s *RepositoryImpl) CreateSession(ctx context.Context, userID uuid.UUID) (*SessionDO, error)

func (*RepositoryImpl) DeleteSession

func (s *RepositoryImpl) DeleteSession(ctx context.Context, sessID string) error

func (*RepositoryImpl) GetSessionByID

func (s *RepositoryImpl) GetSessionByID(ctx context.Context, sessID string) (*SessionDO, error)

type ServerImpl

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

func NewServer

func NewServer(logger logger.Logger, service Service, csrfService CSRFService) ServerImpl

func (*ServerImpl) CheckCsrfToken

func (*ServerImpl) CreateCsrfToken

func (*ServerImpl) CreateSession

func (*ServerImpl) DeleteSession

func (*ServerImpl) GetSessionByID

type Service

type Service interface {
	CreateSession(ctx context.Context, userID uuid.UUID) (*SessionDO, error)
	GetSessionByID(ctx context.Context, sessID string) (*SessionDO, error)
	DeleteSession(ctx context.Context, sessID string) error
}

type ServiceImpl

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

func NewService

func NewService(sessRepo Repository) ServiceImpl

func (*ServiceImpl) CreateSession

func (s *ServiceImpl) CreateSession(ctx context.Context, userID uuid.UUID) (*SessionDO, error)

func (*ServiceImpl) DeleteSession

func (s *ServiceImpl) DeleteSession(ctx context.Context, sessID string) error

func (*ServiceImpl) GetSessionByID

func (s *ServiceImpl) GetSessionByID(ctx context.Context, sessID string) (*SessionDO, error)

type Session

type Session struct {
	UserID    string `protobuf:"bytes,1,opt,name=UserID,proto3" json:"UserID,omitempty"`
	SessionID string `protobuf:"bytes,2,opt,name=SessionID,proto3" json:"SessionID,omitempty"`
	// contains filtered or unexported fields
}

func (*Session) Descriptor deprecated

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

Deprecated: Use Session.ProtoReflect.Descriptor instead.

func (*Session) GetSessionID

func (x *Session) GetSessionID() string

func (*Session) GetUserID

func (x *Session) GetUserID() 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 SessionDO

type SessionDO struct {
	SessionID string    `json:"session_id"`
	UserID    uuid.UUID `json:"user_id"`
}

SessionDO model

func (*SessionDO) FromProto

func (s *SessionDO) FromProto(session *Session) (*SessionDO, error)

type UnimplementedAuthorizationServiceServer

type UnimplementedAuthorizationServiceServer struct {
}

UnimplementedAuthorizationServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedAuthorizationServiceServer) CheckCsrfToken

func (*UnimplementedAuthorizationServiceServer) CreateCsrfToken

func (*UnimplementedAuthorizationServiceServer) CreateSession

func (*UnimplementedAuthorizationServiceServer) DeleteSession

func (*UnimplementedAuthorizationServiceServer) GetSessionByID

Jump to

Keyboard shortcuts

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