Documentation ¶
Index ¶
- func IndexHandler(w http.ResponseWriter, r *http.Request)
- func InfoHeadersHandler(next http.Handler) http.Handler
- func JSONRenderingHandler(next http.Handler) http.Handler
- func LoggingHandler(next http.Handler) http.Handler
- func NewAuthenticationHandler(interactor usecases.SessionInteractor) func(next http.Handler) http.Handler
- func NewContentTypeHandler(contentTypes ...string) func(next http.Handler) http.Handler
- func RecoverHandler(next http.Handler) http.Handler
- type DomainWebHandler
- func (handler *DomainWebHandler) Create(w http.ResponseWriter, r *http.Request)
- func (handler *DomainWebHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (handler *DomainWebHandler) List(w http.ResponseWriter, r *http.Request)
- func (handler *DomainWebHandler) Modify(w http.ResponseWriter, r *http.Request)
- func (handler *DomainWebHandler) Retrieve(w http.ResponseWriter, r *http.Request)
- type Error
- type RBACWebHandler
- type SessionForm
- type SessionResource
- type SessionWebHandler
- func (handler *SessionWebHandler) Check(w http.ResponseWriter, r *http.Request)
- func (handler *SessionWebHandler) Create(w http.ResponseWriter, r *http.Request)
- func (handler *SessionWebHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (handler *SessionWebHandler) Retrieve(w http.ResponseWriter, r *http.Request)
- type UserWebHandler
- func (handler *UserWebHandler) Create(w http.ResponseWriter, r *http.Request)
- func (handler *UserWebHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (handler *UserWebHandler) List(w http.ResponseWriter, r *http.Request)
- func (handler *UserWebHandler) Modify(w http.ResponseWriter, r *http.Request)
- func (handler *UserWebHandler) Retrieve(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IndexHandler ¶
func IndexHandler(w http.ResponseWriter, r *http.Request)
Showing info about API
func InfoHeadersHandler ¶
InfoHeadersHandler is a dummy middleware to add extra headers to the response
func JSONRenderingHandler ¶
JSONRenderingHandler sets application/json as content-type. This helps some typing inside of the individual handlers.
func LoggingHandler ¶
LoggingHandler implements simple logging middleware to log incoming requests (to be extended further)
func NewAuthenticationHandler ¶
func NewAuthenticationHandler(interactor usecases.SessionInteractor) func(next http.Handler) http.Handler
NewAuthenticationHandler create a new handler that handles token-based authentication
func NewContentTypeHandler ¶
NewContentTypeHandler creates a middleware that validates the request content type is acompatible with the provided contentTypes list. It writes a HTTP 415 error if that fails. Only PUT, POST, and PATCH requests are considered.
Types ¶
type DomainWebHandler ¶
type DomainWebHandler struct {
DomainInteractor usecases.DomainInteractor
}
DomainWebHandler is a collection of CRUD methods for Users API
func (*DomainWebHandler) Create ¶
func (handler *DomainWebHandler) Create(w http.ResponseWriter, r *http.Request)
func (*DomainWebHandler) Delete ¶
func (handler *DomainWebHandler) Delete(w http.ResponseWriter, r *http.Request)
func (*DomainWebHandler) List ¶
func (handler *DomainWebHandler) List(w http.ResponseWriter, r *http.Request)
func (*DomainWebHandler) Modify ¶
func (handler *DomainWebHandler) Modify(w http.ResponseWriter, r *http.Request)
func (*DomainWebHandler) Retrieve ¶
func (handler *DomainWebHandler) Retrieve(w http.ResponseWriter, r *http.Request)
type Error ¶
type Error struct { Title string `json:"title"` Message string `json:"message"` Details map[string]interface{} `json:"details,omitempty"` }
Error structure for handler's error responses
type RBACWebHandler ¶
type RBACWebHandler struct { RBACInteractor usecases.RBACInteractor // contains filtered or unexported fields }
RBACWebHandler is a collection of various methods for RBAC
func NewRBACWebHandler ¶
func NewRBACWebHandler() *RBACWebHandler
NewRBACWebHandler creates new SessionWebHandler
func (*RBACWebHandler) AssertPermission ¶
func (handler *RBACWebHandler) AssertPermission(w http.ResponseWriter, r *http.Request)
AssertPermission checks if a current user has a specific permission
func (*RBACWebHandler) AssertRole ¶
func (handler *RBACWebHandler) AssertRole(w http.ResponseWriter, r *http.Request)
AssertRole checks if a current user has a specific role
type SessionForm ¶
type SessionForm struct { Session struct { User struct { Name string `json:"name"` Password string `json:"password"` } `json:"user"` Domain struct { ID string `json:"id"` Name string `json:"name"` } `json:"domain"` } `json:"session"` }
SessionForm used for parsing incoming data
type SessionResource ¶
SessionResource used for responses
type SessionWebHandler ¶
type SessionWebHandler struct { SessionInteractor usecases.SessionInteractor UserInteractor usecases.UserInteractor DomainInteractor usecases.DomainInteractor // contains filtered or unexported fields }
SessionWebHandler is a collection of CRUD methods for Sessions API
func NewSessionWebHandler ¶
func NewSessionWebHandler() *SessionWebHandler
NewSessionWebHandler creates new SessionWebHandler
func (*SessionWebHandler) Check ¶
func (handler *SessionWebHandler) Check(w http.ResponseWriter, r *http.Request)
Check validates if current session is valid
func (*SessionWebHandler) Create ¶
func (handler *SessionWebHandler) Create(w http.ResponseWriter, r *http.Request)
Create opens a new session if none exists
func (*SessionWebHandler) Delete ¶
func (handler *SessionWebHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete deletes current session
func (*SessionWebHandler) Retrieve ¶
func (handler *SessionWebHandler) Retrieve(w http.ResponseWriter, r *http.Request)
Retrieve handles a read request of a current session
type UserWebHandler ¶
type UserWebHandler struct {
UserInteractor usecases.UserInteractor
}
UserWebHandler is a collection of CRUD methods for Users API
func (*UserWebHandler) Create ¶
func (handler *UserWebHandler) Create(w http.ResponseWriter, r *http.Request)
func (*UserWebHandler) Delete ¶
func (handler *UserWebHandler) Delete(w http.ResponseWriter, r *http.Request)
func (*UserWebHandler) List ¶
func (handler *UserWebHandler) List(w http.ResponseWriter, r *http.Request)
func (*UserWebHandler) Modify ¶
func (handler *UserWebHandler) Modify(w http.ResponseWriter, r *http.Request)
func (*UserWebHandler) Retrieve ¶
func (handler *UserWebHandler) Retrieve(w http.ResponseWriter, r *http.Request)