Documentation ¶
Index ¶
- Constants
- type API
- func (s *API) Handler() http.Handler
- func (s *API) JwtMiddleware(next http.Handler) http.Handler
- func (s *API) Login(w http.ResponseWriter, r *http.Request)
- func (s *API) MustBeAdmin(next http.Handler) http.Handler
- func (s *API) MustBeAuthed(next http.Handler) http.Handler
- func (s *API) MustBeProposer(next http.Handler) http.Handler
- func (s *API) Signup(w http.ResponseWriter, r *http.Request)
Constants ¶
View Source
const (
// CookieAuthKey is the cookie key that will be used to set the client authorization cookie
CookieAuthKey = "auth-token"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the magic behind the api
func (*API) JwtMiddleware ¶
JwtMiddleware is a middleware that attaches the user to the request context
func (*API) Login ¶
func (s *API) Login(w http.ResponseWriter, r *http.Request)
Login is the handler behind /api/auth/login.
func (*API) MustBeAdmin ¶
MustBeAdmin is a middleware that makes sure that the user creating the request is an admin.
func (*API) MustBeAuthed ¶
MustBeAuthed is a middleware that makes sure that the user creating the request is authenticated.
func (*API) MustBeProposer ¶
MustBeProposer is a middleware that makes sure that the user creating the request is a proposer.
Click to show internal directories.
Click to hide internal directories.