Documentation ¶
Index ¶
- func Middleware(cfg *config.Config, db *pg.DB) (echo.MiddlewareFunc, echo.MiddlewareFunc)
- func RegisterRoutes(e *echo.Echo, cfg *config.Config, db *pg.DB, ...)
- type RetrieveSessionOptions
- type Service
- func (svc *Service) ParseToken(_ context.Context, signed string) (*Session, error)
- func (svc *Service) RetrieveSession(ctx context.Context, opts RetrieveSessionOptions) (*Session, error)
- func (svc *Service) SignSession(_ context.Context, session *Session) (string, error)
- func (svc *Service) UpdateSession(ctx context.Context, session *Session, opts UpdateSessionOptions) error
- type Session
- type UpdateSessionOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func RegisterRoutes ¶
func RegisterRoutes(e *echo.Echo, cfg *config.Config, db *pg.DB, nonEnforceAuth echo.MiddlewareFunc)
RegisterRoutes takes in an Echo router and registers routes onto it.
Types ¶
type RetrieveSessionOptions ¶
type RetrieveSessionOptions struct {
Username *string
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) ParseToken ¶
func (*Service) RetrieveSession ¶
func (*Service) SignSession ¶
func (*Service) UpdateSession ¶
type Session ¶
type Session struct { ID int `json:"id"` Username string `json:"username"` FriendCode3DS *string `pg:"friend_code_3ds" json:"friend_code_3ds"` FriendCodeSwitch *string `json:"friend_code_switch"` Password string `json:"-"` LastIP *string `json:"-"` LastLogin *time.Time `json:"-"` DateCreated time.Time `json:"date_created"` DateModified time.Time `json:"date_modified"` // This is so that we can use this struct as a Claims struct, and we can sign it as a payload. jwt.RegisteredClaims `pg:"-"` // contains filtered or unexported fields }
func FromContext ¶
func FromContext(c echo.Context) *Session
func (*Session) MarshalJSON ¶
MarshalJSON is just needed for parity testing. Once we're actually using this in production, we can remove it.
type UpdateSessionOptions ¶
type UpdateSessionOptions struct {
Columns []string
}
Click to show internal directories.
Click to hide internal directories.