16 lines
482 B
Go
16 lines
482 B
Go
package middleware
|
|
|
|
import (
|
|
"context"
|
|
|
|
"5803025020/w04/internal/models"
|
|
)
|
|
|
|
// SessionLookup is the small interface RequireAuth needs to resolve a bearer
|
|
// token to the session (and therefore the user id) it belongs to. Defined
|
|
// here (the consumer) so internal/store never needs to import middleware.
|
|
// *store.SessionStore satisfies this implicitly via its existing Get method.
|
|
type SessionLookup interface {
|
|
Get(ctx context.Context, token string) (*models.Session, error)
|
|
}
|