
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
httplease-asap
Advanced tools
This is an implementation of ASAP S2S Authentication as an httplease filter.
Install the library:
npm install --save httplease-asap
For more examples have a look at the test/integration directory.
const httplease = require('httplease');
const httpleaseAsap = require('httplease-asap');
const jwtConfig = {
privateKey: 'private key in pem format',
issuer: 'an-issuer',
keyId: 'the-keyid',
audience: 'an-audience'
};
// this can be saved and reused as many times as you want
const httpClient = httplease.builder()
.withBaseUrl('http://example.com/basePath')
.withFilter(httpleaseAsap.createJwtAuthFilter(jwtConfig));
// make a request
httpClient
.withPath('/post')
.withMethodGet()
.send();
const httpleaseAsap = require('httplease-asap');
const dataUri = 'data:application/pkcs8;kid=an-issuer%2Fthe-keyid;base64,private key in base64 DER format';
const jwtConfig = Object.assign({
issuer: 'an-issuer',
audience: 'an-audience'
}, httpleaseAsap.parseDataUri(dataUri));
The same jwtConfig format can be used to create a httplease filter or just a function which when called returns an authorization header.
const httpleaseAsap = require('httplease-asap');
const jwtConfig = {
privateKey: 'private key in pem format',
issuer: 'an-issuer',
keyId: 'the-keyid',
audience: 'an-audience',
tokenExpiryMs: 10 * 60 * 1000, // Optional, max is 1 hour. This is how long the generated token stays valid.
tokenMaxAgeMs: 9 * 60 * 1000 // Optional, must be less than tokenExpiryMs. How long to cache the token.
};
const authHeaderGenerator = httpleaseAsap.createAuthHeaderGenerator(jwtConfig);
const authHeader = authHeaderGenerator();
console.log(authHeader); // Bearer abcd1234
Just add them to your jwtConfig and use them with either createJwtAuthFilter or createAuthHeaderGenerator.
const jwtConfig = {
// the usual stuff
additionalClaims: {
myCustomClaim: 'hello world'
}
}
npm install
# Run all checks
npm test
# Run just the jasmine tests
npm run test:jasmine
# Run just the linter
npm run test:lint
npm version 99.98.97
npm publish
git push
git push --tags
Pull requests, issues and comments welcome. For pull requests:
See the existing issues for things to start contributing.
For bigger changes, make sure you start a discussion first by creating an issue and explaining the intended change.
Atlassian requires contributors to sign a Contributor License Agreement, known as a CLA. This serves as a record stating that the contributor is entitled to contribute the code/documentation/translation to the project and is willing to have it used in distributions and derivative works (or is willing to transfer ownership).
Copyright (c) 2016 Atlassian and others. Apache 2.0 licensed, see LICENSE file.
FAQs
ASAP authentication filter for httplease
The npm package httplease-asap receives a total of 2,237 weekly downloads. As such, httplease-asap popularity was classified as popular.
We found that httplease-asap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.