Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hydra-express

Package Overview
Dependencies
Maintainers
1
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hydra-express - npm Package Compare versions

Comparing version 1.3.8 to 1.4.1

15

documentation.md

@@ -74,3 +74,3 @@ ![logo](hydra-express.png)

HydraExpress includes a `log` member which allows you to log into to both the console and log file.
HydraExpress includes a `log` member which allows you to log into to both the console and log file.

@@ -212,12 +212,7 @@ ```javascript

#### validateJwtToken
Express middleware to validate a JWT sent via the req.authorization header
```javascript
/**
* @name validateJwtToken
* @summary Express middleware to validate a JWT sent via the req.authorization header
* @return {function} Middleware function
*/
validateJwtToken()
```
*DEPRECATED*
This functionality has been extracted to the [jwt-auth plugin](http://github.com/flywheelsports/hydra-express-plugin-jwt-auth).
## Hydra / Express configuration

@@ -224,0 +219,0 @@

@@ -36,3 +36,2 @@ /**

const responseTime = require('response-time');
const jwtAuth = require('fwsp-jwt-auth');

@@ -182,10 +181,3 @@ let app = express();

return Promise.series(this.registeredPlugins, (plugin) => plugin.setConfig(config))
.then((..._results) => {
if (config.jwtPublicCert) {
return jwtAuth.loadCerts(null, config.jwtPublicCert)
.catch((_err) => reject(new Error('Can\'t load public cert')));
}
})
.then(() => this.start(resolve, reject))
return Promise.try(this.start(resolve, reject))
.catch((err) => this.log('error', err.toString()));

@@ -237,11 +229,2 @@ }

/**
* @name getJwtAuth
* @summary Retrieve the underlying jwtAuth object
* @return {object} jwtAuth - jwtAuth object
*/
getJwtAuth() {
return jwtAuth;
}
/**
* @name getRuntimeConfig

@@ -308,4 +291,5 @@ * @summary Retrieve loaded configuration object

this.config = config;
return hydra.registerService();
return Promise.series(this.registeredPlugins, plugin => plugin.setConfig(config));
})
.then(() => hydra.registerService())
.then((_serviceInfo) => {

@@ -316,3 +300,3 @@ serviceInfo = _serviceInfo;

this.initService();
return Promise.series(this.registeredPlugins, (plugin) => plugin.onServiceReady());
return Promise.series(this.registeredPlugins, plugin => plugin.onServiceReady());
})

@@ -530,41 +514,2 @@ .then((..._results) => {

/**
* @name _validateJwtToken
* @summary Express middleware to validate a JWT sent via the req.authorization header
* @return {function} Middleware function
*/
_validateJwtToken() {
return (req, res, next) => {
let authHeader = req.headers.authorization;
if (!authHeader) {
this.sendResponse(ServerResponse.HTTP_UNAUTHORIZED, res, {
result: {
reason: 'Invalid token'
}
});
} else {
let token = authHeader.split(' ')[1];
if (token) {
return jwtAuth.verifyToken(token)
.then((decoded) => {
req.authToken = decoded;
next();
})
.catch((err) => {
this.sendResponse(ServerResponse.HTTP_UNAUTHORIZED, res, {
result: {
reason: err.message
}
});
});
} else {
this.sendResponse(ServerResponse.HTTP_UNAUTHORIZED, res, {
result: {
reason: 'Invalid token'
}
});
}
}
};
}
}

@@ -662,11 +607,2 @@

/**
* @name getJwtAuth
* @summary Retrieve the underlying jwtAuth object
* @return {object} jwtAuth - jwtAuth object
*/
getJwtAuth() {
return super.getJwtAuth();
}
/**
* @name getRuntimeConfig

@@ -714,12 +650,4 @@ * @summary Retrieve loaded configuration object

/**
* @name validateJwtToken
* @summary Express middleware to validate a JWT sent via the req.authorization header
* @return {function} Middleware function
*/
validateJwtToken() {
return super._validateJwtToken();
}
}
module.exports = new IHydraExpress;
{
"name": "hydra-express",
"version": "1.3.8",
"version": "1.4.1",
"description": "A module which wraps Hydra and ExpressJS to provide an out of the box microservice which can support API routes and handlers.",

@@ -46,4 +46,3 @@ "author": {

"hydra": "1.3.6",
"fwsp-jwt-auth": "0.1.0",
"helmet": "3.5.0",
"helmet": "3.6.0",
"moment": "2.18.1",

@@ -50,0 +49,0 @@ "response-time": "2.3.2"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc