![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
limes authenticates users.
$ npm install limes
First you need to add a reference to limes in your application.
var Limes = require('limes');
Then you can call the Limes
constructor function to create a new limes instance. You need to specify a parameter object with the identityProviderName
and either a privateKey
or a certificate
, each in .pem
format. Optionally, you may also provide both.
var limes = new Limes({
identityProviderName: 'auth.example.com',
privateKey: fs.readFileSync(path.join(__dirname, 'privateKey.pem')),
certificate: fs.readFileSync(path.join(__dirname, 'certificate.pem'))
});
Please note that you have to specify the private key if you want to issue tokens and the certificate if you want to verify them.
To issue a token call the issueTokenFor
function and provide the subject you want to issue the token for as well as the desired payload.
var token = limes.issueTokenFor('Jane Doe', {
foo: 'bar'
});
To verify a token call the verifyToken
function and provide the token and a callback. As a result, it returns the decoded token.
limes.verifyToken(token, function (err, decodedToken) {
// ...
});
To verify tokens there are also middlewares for Express and Socket.io. To use them call the verifyTokenMiddlewareExpress
or verifyTokenMiddlewareSocketIo
functions and optionally specify the payload for non-authenticated users.
app.use(limes.verifyTokenMiddlewareExpress({
payloadWhenAnonymous: {
foo: 'bar'
}
}));
io.use(limes.verifyTokenMiddlewareSocketIo({
payloadWhenAnonymous: {
foo: 'bar'
}
}));
If a request does not provide a token, an anonymous token is issued. If a request does have an invalid token, an expired one, or one with a wrong issuer, the middleware returns a 401
respectively an error.
Otherwise, it attaches the decoded token to req.user
respectively socket.user
.
The Express middleware expects the token to be inside an HTTP header called authorization
and prefixed with the term Bearer
.
authorization: Bearer <token>
Alternatively, you may transfer the token using the query string parameter token
.
GET /foo/bar?token=<token>
The Socket.io middleware expects you to emit an authenticate
event and provide the token as well as a callback.
socket.emit('authenticate', token, function (err) {
// ...
});
This module can be built using Grunt. Besides running the tests, this also analyses the code. To run Grunt, go to the folder where you have installed limes and run grunt
. You need to have grunt-cli installed.
$ grunt
The MIT License (MIT) Copyright (c) 2014-2015 the native web.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
limes authenticates users.
The npm package limes receives a total of 17,657 weekly downloads. As such, limes popularity was classified as popular.
We found that limes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.