Documentation ¶
Index ¶
- func Authentication(userStore docshelf.UserStore) func(http.Handler) http.Handler
- type Auth
- type Claims
- type DocHandler
- func (h DocHandler) DeleteDoc(w http.ResponseWriter, r *http.Request)
- func (h DocHandler) GetDoc(w http.ResponseWriter, r *http.Request)
- func (h DocHandler) GetList(w http.ResponseWriter, r *http.Request)
- func (h DocHandler) PinDoc(w http.ResponseWriter, r *http.Request)
- func (h DocHandler) PostDoc(w http.ResponseWriter, r *http.Request)
- func (h DocHandler) PostTag(w http.ResponseWriter, r *http.Request)
- func (h DocHandler) RenderDoc(w http.ResponseWriter, r *http.Request)
- type ID
- type Server
- type TagReq
- type UserHandler
- func (h UserHandler) DeleteUser(w http.ResponseWriter, r *http.Request)
- func (h UserHandler) GetCurrentUser(w http.ResponseWriter, r *http.Request)
- func (h UserHandler) GetUser(w http.ResponseWriter, r *http.Request)
- func (h UserHandler) GetUsers(w http.ResponseWriter, r *http.Request)
- func (h UserHandler) PostUser(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authentication ¶
Authentication is a middleware that verifies a user's identity before passing control to the underlying HTTP handler. If the user is verified, their data is pulled and attached to the request context so it can be referenced at all stages later on.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth provides a simple implementation of the Authenticator interface. It does a simple lookup of the user and confirms whether or not the credentials match what's stored.
type Claims ¶
type Claims struct { jwt.StandardClaims Email string `json:"email"` Name string `json:"name"` }
Claims represent claimed data embedded in an ouath access token.
type DocHandler ¶
type DocHandler struct {
// contains filtered or unexported fields
}
A DocHandler has methods that can handle HTTP requests for Docs.
func NewDocHandler ¶
func NewDocHandler(docStore docshelf.DocStore, logger *logrus.Logger) DocHandler
NewDocHandler returns a DocHandler struct using the given DocStore and Logger instance.
func (DocHandler) DeleteDoc ¶
func (h DocHandler) DeleteDoc(w http.ResponseWriter, r *http.Request)
DeleteDoc handles requests for removing specific Docs.
func (DocHandler) GetDoc ¶
func (h DocHandler) GetDoc(w http.ResponseWriter, r *http.Request)
GetDoc handles requests for fetching specific Docs.
func (DocHandler) GetList ¶
func (h DocHandler) GetList(w http.ResponseWriter, r *http.Request)
GetList handles requests for listing Docs by path prefix.
func (DocHandler) PinDoc ¶
func (h DocHandler) PinDoc(w http.ResponseWriter, r *http.Request)
PinDoc handles requests from users to pin a document. It applies a special tag to the doc which can be used later to find a user's pinned documents.
func (DocHandler) PostDoc ¶
func (h DocHandler) PostDoc(w http.ResponseWriter, r *http.Request)
PostDoc handles requests for posting new (or existing) Docs.
func (DocHandler) PostTag ¶
func (h DocHandler) PostTag(w http.ResponseWriter, r *http.Request)
PostTag handles requests for posting tags to an existing Doc.
func (DocHandler) RenderDoc ¶
func (h DocHandler) RenderDoc(w http.ResponseWriter, r *http.Request)
RenderDoc handles requests for rendering Documents as HTML.
type ID ¶
type ID struct {
ID string `json:"id"`
}
ID is a struct for marshaling to and from JSON documents containing an ID.
type Server ¶
type Server struct { DocHandler DocHandler UserStore docshelf.UserStore GroupStore docshelf.GroupStore PolicyStore docshelf.PolicyStore // contains filtered or unexported fields }
A Server is a collection of stores that get wired up to HTTP endpoint.
func (Server) AddAuth ¶
func (s Server) AddAuth(name string, auth docshelf.Authenticator)
AddAuth method to server.
func (Server) CheckHandlers ¶
CheckHandlers returns an error if the Server contains any invalid handlers.
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
A UserHandler has methods that can handle HTTP requests for Users.
func NewUserHandler ¶
func NewUserHandler(userStore docshelf.UserStore, logger *logrus.Logger) UserHandler
NewUserHandler returns a UserHandler struct using the given UserStore and Logger instance.
func (UserHandler) DeleteUser ¶
func (h UserHandler) DeleteUser(w http.ResponseWriter, r *http.Request)
DeleteUser handles requests for deleting specific Users.
func (UserHandler) GetCurrentUser ¶
func (h UserHandler) GetCurrentUser(w http.ResponseWriter, r *http.Request)
GetCurrentUser handles requests for fetching the currently logged in user.
func (UserHandler) GetUser ¶
func (h UserHandler) GetUser(w http.ResponseWriter, r *http.Request)
GetUser handles requests for fetching specific Users.
func (UserHandler) GetUsers ¶
func (h UserHandler) GetUsers(w http.ResponseWriter, r *http.Request)
GetUsers handles requests for listing all Users.
func (UserHandler) PostUser ¶
func (h UserHandler) PostUser(w http.ResponseWriter, r *http.Request)
PostUser handles requests for posting new (or updating existing) Users.