Rewrote authentication
logic – it now supports Auth0 style authentication: expiring "access tokens" and "refresh tokens" (with automatic token refresh feature).
Breaking changes:
authentication
used to be a function. Now it's an object rather than a function.authentication : function(payload)
->authentication.userInfo : function(payload)
- Added
authentication.refreshAccessToken(ctx)
optional parameter for automatically refreshing expired tokens - Route handlers (including
api
route handlers) are no longer bound tothis
, use the newctx
parameter instead:({ ... }, { ..., ctx }) => {}
jwt()
function parameters renamed:user_id
->userId
,jwt_id
->tokenId
.expiresIn
parameter added.keys
parameter changed to a singlekey
(pass it likekey: keys[0]
)authentication_token_id
andauthentication_token
route handler parameters removed (useaccessTokenId
andaccessToken
instead)ctx.authenticate()
function removed (wasn't used at all). Renamed:ctx.jwt_id
->ctx.accessTokenId
,ctx.jwt
->ctx.accessToken
,ctx.authentication_error
-> removed,ctx.token_data
->ctx.accessTokenPayload
authentication.validate_token
option removedparse_body
option renamed toparseBody
- Fix for
Date
parsing regular expression
- Added HTTP error "429 Too Many Requests"
- JWT is now only looked up in the HTTP Authorization header. JWT is no more looked up in the
authentication
cookie since it's prone to Cross-Site Request Forgery attacks.
- (breaking change) file upload's
stream
function now takes an extrafields
attribute (form fields) - (breaking change) removed
postprocess
option of file upload (useprocess
instead) - (breaking change) file upload
respond
is now synchronous - now exporting a basic
generateUniqueFilename(path)
helper function
routing
andapi
now don't wrap primitives into a JSON object when sending HTTP response
- Fixed HTTP status
204
being sent instead of200
for HEADs, GETs, POSTs and PATCHes.
- Added
Date
parsing forrouting
(andapi
) parameters
http
utility nowreject
s thePromise
with theerror
slightly different from what it was in0.1.x
: it used to have.code
property set to HTTP response status, but now that.code
property is renamed to.status
(I guess the new name better suits it)
- Fixed a bug of
PUT and DELETE HTTP queries must not return any content
error being thrown when a Promise is returned from a route handler
- Placed a restriction on
PUT
andDELETE
HTTP queries to not return any content - Added
date_parser
tohttp
utility
- Fixed returning
Promise
s in routes resolving to strange objects of form{ _c: [], _s: 0, _d: false, _h: 0, _n: false }
- Renamed
to_name
to justname
for proxying
detect_locale
now setsctx.locale
variable which can be read, for example, in route handlers asthis.locale
- Added
options
argument toproxy
function. Seehttp-proxy
options.
- Renamed
http
utility (which is passed insideparameters
object of route handlers) tointernal_http
, emphasizing the fact that it should only be used to send HTTP requests to your own servers because it will also send JWT token header and therefore it would expose that sensitive information to a third party if used for external HTTP requests.
- Added
stream(file, response)
parameter forfile_upload
which bypasses writing the uploaded files to disk.stream
must either return a Promise (the resolved value will be later sent back in HTTP response) or stream response data directly to HTTPresponse
. Ifstream
is set, thenprocess
won't be called.
- Added
process
parameter forfile_upload
which can process each file individually in parallel returning a result, whilepostprocess
is applied at the end when all files are uploaded andprocess
ed.
- Parallelized file upload
- A little breaking change of
on_file_uploaded
function parameters: now takes an object.
- Added short-hand aliases for
file_upload
andserve_static_files
. Refactoredfile_upload
function call parameters.
- Removed
development
option. CheckingNODE_ENV
now.
- Fixed bugs found by @once-ler. Introduced
development
option.
- Initial release