Documentation ¶
Index ¶
- func AdminRouteRoleCheck(decodedToken []string) string
- func AdminTokenVerifyMiddleWare(next http.HandlerFunc, config configuration.Configuration, ...) http.HandlerFunc
- func CreateToken(user root.User, config configuration.Configuration, exp int64) string
- func DecodeJWT(curToken string, config configuration.Configuration) []string
- func HandleOptionsRequest(w http.ResponseWriter, r *http.Request)
- func Logger(inner http.Handler, name string) http.Handler
- func MemberTokenVerifyMiddleWare(next http.HandlerFunc, config configuration.Configuration, ...) http.HandlerFunc
- func NewGroupRouter(g root.GroupService, router *mux.Router, config configuration.Configuration, ...) *mux.Router
- func NewLoggingResponseWriter(w http.ResponseWriter) *loggingResponseWriter
- func NewTodoRouter(t root.TodoService, router *mux.Router, config configuration.Configuration, ...) *mux.Router
- func NewUserRouter(u root.UserService, router *mux.Router, o root.GroupService, ...) *mux.Router
- func SetResponseHeaders(w http.ResponseWriter, authToken string, apiKey string) http.ResponseWriter
- type JWTError
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdminRouteRoleCheck ¶
AdminRouteRoleCheck checks admin routes JWT tokens to ensure that a group admin does not break scope
func AdminTokenVerifyMiddleWare ¶
func AdminTokenVerifyMiddleWare(next http.HandlerFunc, config configuration.Configuration, client *mongo.Client) http.HandlerFunc
AdminTokenVerifyMiddleWare is used to verify that the requester is a valid admin
func CreateToken ¶
func CreateToken(user root.User, config configuration.Configuration, exp int64) string
CreateToken is used to create a new session JWT token
func DecodeJWT ¶
func DecodeJWT(curToken string, config configuration.Configuration) []string
DecodeJWT is used to decode a JWT token
func HandleOptionsRequest ¶
func HandleOptionsRequest(w http.ResponseWriter, r *http.Request)
HandleOptionsRequest handles incoming OPTIONS request
func MemberTokenVerifyMiddleWare ¶
func MemberTokenVerifyMiddleWare(next http.HandlerFunc, config configuration.Configuration, client *mongo.Client) http.HandlerFunc
MemberTokenVerifyMiddleWare is used to verify that a requester is authenticated
func NewGroupRouter ¶
func NewGroupRouter(g root.GroupService, router *mux.Router, config configuration.Configuration, client *mongo.Client) *mux.Router
NewGroupRouter is a function that initializes a new groupRouter struct
func NewLoggingResponseWriter ¶
func NewLoggingResponseWriter(w http.ResponseWriter) *loggingResponseWriter
NewLoggingResponseWriter is a function used to write API log data to the console
func NewTodoRouter ¶
func NewTodoRouter(t root.TodoService, router *mux.Router, config configuration.Configuration, client *mongo.Client) *mux.Router
NewTodoRouter is a function that initializes a new todoRouter struct
func NewUserRouter ¶
func NewUserRouter(u root.UserService, router *mux.Router, o root.GroupService, config configuration.Configuration, client *mongo.Client) *mux.Router
NewUserRouter is a function that initializes a new userRouter struct
func SetResponseHeaders ¶
func SetResponseHeaders(w http.ResponseWriter, authToken string, apiKey string) http.ResponseWriter
SetResponseHeaders sets the response headers being sent back to the client
Types ¶
type JWTError ¶
type JWTError struct {
Message string `json:"message"`
}
JWTError is a struct that is used to contain a json encoded error message for any JWT related errors
type Server ¶
type Server struct { Router *mux.Router Config configuration.Configuration UserService root.UserService GroupService root.GroupService TodoService root.TodoService }
Server is a struct that stores the API Apps high level attributes such as the router, config, and services
func NewServer ¶
func NewServer(u root.UserService, g root.GroupService, t root.TodoService, config configuration.Configuration, client *mongo.Client) *Server
NewServer is a function used to initialize a new Server struct