New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

limes

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

limes - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

8

lib/Limes.js

@@ -28,3 +28,3 @@ 'use strict';

Limes.prototype.issueTokenFor = function (subject, payload) {
if (!subject && subject !== '') {
if (!subject) {
throw new Error('Subject is missing.');

@@ -37,3 +37,3 @@ }

algorithm: 'RS256',
expiresInMinutes: this.expiresInMinutes,
expiresIn: this.expiresInMinutes * 60,
subject: subject,

@@ -45,3 +45,3 @@ issuer: this.identityProviderName

Limes.prototype.issueTokenForAnonymous = function (payload) {
return this.issueTokenFor('', payload);
return this.issueTokenFor('anonymous', payload);
};

@@ -62,3 +62,3 @@

token.iss = this.identityProviderName;
token.sub = undefined;
token.sub = 'anonymous';

@@ -65,0 +65,0 @@ return token;

{
"name": "limes",
"version": "0.4.0",
"version": "0.5.0",
"description": "limes authenticates users.",

@@ -17,4 +17,4 @@ "contributors": [

"dependencies": {
"express-jwt": "3.0.1",
"jsonwebtoken": "5.0.4",
"express-jwt": "3.1.0",
"jsonwebtoken": "5.4.1",
"middleware-flow": "0.8.0"

@@ -24,8 +24,8 @@ },

"assertthat": "0.6.0",
"express": "4.13.1",
"express": "4.13.3",
"grunt": "0.4.5",
"socket.io": "1.3.6",
"socket.io-client": "1.3.6",
"supertest": "1.0.1",
"tourism": "0.20.2"
"socket.io": "1.3.7",
"socket.io-client": "1.3.7",
"supertest": "1.1.0",
"tourism": "0.21.0"
},

@@ -32,0 +32,0 @@ "repository": {

@@ -75,3 +75,3 @@ # limes

Alternatively, you may transfer the token using the query string parameter `token`:
Alternatively, you may transfer the token using the query string parameter `token`.

@@ -78,0 +78,0 @@ GET /foo/bar?token=<token>

@@ -122,3 +122,3 @@ 'use strict';

assert.that(decodedToken.iss).is.equalTo('auth.example.com');
assert.that(decodedToken.sub).is.undefined();
assert.that(decodedToken.sub).is.equalTo('anonymous');
assert.that(decodedToken.foo).is.equalTo('bar');

@@ -174,2 +174,15 @@ done();

});
test('returns an error if the token contains invalid characters.', function (done) {
var limes = new Limes({
identityProviderName: 'auth.example.com',
privateKey: privateKey,
certificate: certificate
});
limes.verifyToken('invalid token', function (err) {
assert.that(err).is.not.null();
done();
});
});
});

@@ -251,3 +264,3 @@

assert.that(res.body.iss).is.equalTo('auth.example.com');
assert.that(res.body.sub).is.undefined();
assert.that(res.body.sub).is.equalTo('anonymous');
assert.that(res.body.foo).is.equalTo('anonymous-bar');

@@ -264,3 +277,3 @@ done();

end(function (err, res) {
assert.that(err).is.not.null();
assert.that(err).is.null();
assert.that(res.statusCode).is.equalTo(401);

@@ -271,2 +284,14 @@ done();

test('returns 401 for tokens with invalid characters.', function (done) {
request(app).
get('/').
set('accept', 'application/json').
set('authorization', 'Bearer invalid token').
end(function (err, res) {
assert.that(err).is.null();
assert.that(res.statusCode).is.equalTo(401);
done();
});
});
test('returns 401 for expired requests.', function (done) {

@@ -282,3 +307,3 @@ var expiredToken = limesInThePast.issueTokenFor('test.domain.com', {

end(function (err, res) {
assert.that(err).is.not.null();
assert.that(err).is.null();
assert.that(res.statusCode).is.equalTo(401);

@@ -299,3 +324,3 @@ done();

end(function (err, res) {
assert.that(err).is.not.null();
assert.that(err).is.null();
assert.that(res.statusCode).is.equalTo(401);

@@ -406,3 +431,3 @@ done();

assert.that(token.iss).is.equalTo('auth.example.com');
assert.that(token.sub).is.undefined();
assert.that(token.sub).is.equalTo('anonymous');
assert.that(token.foo).is.equalTo('anonymous-bar');

@@ -409,0 +434,0 @@ socket.disconnect();

Sorry, the diff of this file is not supported yet

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