server

package
v0.0.0-...-47b55c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminRouteRoleCheck

func AdminRouteRoleCheck(decodedToken []string) string

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 Logger

func Logger(inner http.Handler, name string) http.Handler

Logger is a function that is used to manage the API logging process

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

func (*Server) Start

func (s *Server) Start()

Start starts the initialized server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL