Documentation ¶
Index ¶
- func AuthenticationRequiredMiddleware(next http.Handler) http.Handler
- func CreateSignedToken(claims *UserClaim) (string, error)
- func ErrorResponseWriter(rw http.ResponseWriter, statusCode int, message string, data interface{}) error
- func JSONContentTypeMiddleware(next http.Handler) http.Handler
- func LoggingMiddleware(next http.Handler) http.Handler
- func PaginatedResponseWriter(rw http.ResponseWriter, statusCode int, message string, count int, next string, ...) error
- func ParseToken(tokenString string, claims *UserClaim) (*jwt.Token, error)
- func ResponseWriter(rw http.ResponseWriter, statusCode int, message string, student models.Student) error
- type Credentials
- type UserClaim
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticationRequiredMiddleware ¶
AuthenticationRequiredMiddleware will check if the user has valid permissions
func CreateSignedToken ¶
createSignedToken will create and return a signed token based on the username
func ErrorResponseWriter ¶
func ErrorResponseWriter(rw http.ResponseWriter, statusCode int, message string, data interface{}) error
ErrorResponseWriter writes response of type - ErrorResponse
func JSONContentTypeMiddleware ¶
JSONContentTypeMiddleware will add the json content type header for all endpoints
func LoggingMiddleware ¶
LoggingMiddleware will log all requests
func PaginatedResponseWriter ¶
func PaginatedResponseWriter(rw http.ResponseWriter, statusCode int, message string, count int, next string, prev string, students []models.Student) error
PaginatedResponseWriter writes response of type - PaginatedResponse
func ParseToken ¶
parseToken will parse a token from a string
func ResponseWriter ¶
func ResponseWriter(rw http.ResponseWriter, statusCode int, message string, student models.Student) error
ResponseWriter writes response of type - Response
Types ¶
type Credentials ¶
type UserClaim ¶
type UserClaim struct { *jwt.StandardClaims UserInfo }
Click to show internal directories.
Click to hide internal directories.