-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from jtrw/develop
Add new authentication and size limit middleware
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,33 @@ | ||
# go-rest | ||
|
||
[![Build Status](https://github.com/jtrw/go-rest/workflows/Build/badge.svg)](https://github.com/jtrw/go-rest/actions) | ||
[![Coverage Status](https://coveralls.io/repos/github/jtrw/go-rest/badge.svg?branch=master)](https://coveralls.io/github/jtrw/go-rest?branch=master) | ||
|
||
Middleware for REST API | ||
|
||
1. Ping | ||
2. PanicRecovery | ||
3. Authentication via header | ||
4. Authentication via JWT token | ||
5. RealIP | ||
6. SizeLimit | ||
|
||
### Authentication via header | ||
|
||
Authentication is a middleware that checks for a header with a given name and value. | ||
|
||
### Authentication via JWT token | ||
|
||
AuthenticationJWT is a middleware that checks for a JWT token in the Authorization header. | ||
|
||
### BasicAuth middleware | ||
|
||
BasicAuth middleware checks for a username and password in the request's Authorization header. | ||
|
||
### SizeLimit middleware | ||
|
||
SizeLimit middleware checks if body size is above the limit and returns StatusRequestEntityTooLarge (413) | ||
|
||
### RealIP middleware | ||
|
||
RealIP is a middleware that sets a http.Request's RemoteAddr to the results of parsing either the X-Forwarded-For or X-Real-IP headers. |