Documentation
¶
Index ¶
- Variables
- type Handler
- func (h *Handler) Create(ctx context.Context, req *auth_proto.InternalOAuthSessionsServiceCreateRequest) (*auth_proto.InternalOAuthSessionsServiceCreateResponse, error)
- func (h *Handler) Delete(ctx context.Context, req *auth_proto.InternalOAuthSessionsServiceDeleteRequest) (*auth_proto.InternalOAuthSessionsServiceDeleteResponse, error)
- func (h *Handler) Get(ctx context.Context, req *auth_proto.InternalOAuthSessionsServiceGetRequest) (*auth_proto.InternalOAuthSessionsServiceGetResponse, error)
- type Payload
- type Repository
- type Session
- type SessionRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrSessionNotFound = errors.New("session not found")
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
auth_proto.UnimplementedInternalOAuthSessionsServiceServer
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(repo SessionRepository) *Handler
func (*Handler) Create ¶
func (h *Handler) Create(ctx context.Context, req *auth_proto.InternalOAuthSessionsServiceCreateRequest) (*auth_proto.InternalOAuthSessionsServiceCreateResponse, error)
func (*Handler) Delete ¶
func (h *Handler) Delete(ctx context.Context, req *auth_proto.InternalOAuthSessionsServiceDeleteRequest) (*auth_proto.InternalOAuthSessionsServiceDeleteResponse, error)
func (*Handler) Get ¶
func (h *Handler) Get(ctx context.Context, req *auth_proto.InternalOAuthSessionsServiceGetRequest) (*auth_proto.InternalOAuthSessionsServiceGetResponse, error)
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(db storage.Database) *Repository
func (*Repository) FindUnexpired ¶
type Session ¶
type Session struct {
Key string // Key is the oAuth state parameter passed in
Payload Payload
CreatedAt time.Time
ExpiresAt time.Time
}
func NewSession ¶
type SessionRepository ¶
type SessionRepository interface {
Create(ctx context.Context, session Session) (*Session, error)
FindUnexpired(ctx context.Context, key string) (*Session, bool, error)
Delete(ctx context.Context, key string) error
}
SessionRepository is the interface the Handler depends on, allowing a mock to be injected in tests.
Click to show internal directories.
Click to hide internal directories.