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

openid-client

Package Overview
Dependencies
Maintainers
1
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openid-client - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

lib/client.js

5

CHANGELOG.md

@@ -8,2 +8,3 @@ # openid-client CHANGELOG

<!-- TOC START min:2 max:2 link:true update:true -->
- [Version 1.2.0](#version-120)
- [Version 1.1.0](#version-110)

@@ -18,2 +19,6 @@ - [Version 1.0.2](#version-102)

## Version 1.2.0
- [DIFF](https://github.com/panva/node-openid-client/compare/v1.1.0...v1.2.0)
- added `#decodedIdToken` getter to TokenSets returned from `authorizationCallback` and `refresh`;
## Version 1.1.0

@@ -20,0 +25,0 @@ - [DIFF](https://github.com/panva/node-openid-client/compare/v1.0.2...v1.1.0)

2

lib/issuer.js

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

const gotErrorHandler = require('./got_error_handler');
const BaseClient = require('./base_client');
const BaseClient = require('./client');
const registry = require('./issuer_registry');

@@ -22,0 +22,0 @@ const webfingerNormalize = require('./webfinger_normalize');

'use strict';
const now = require('./unix_timestamp');
const base64url = require('base64url');
const decodedClaims = new WeakMap();
class TokenSet {

@@ -21,4 +24,13 @@ constructor(values) {

}
get claims() {
if (decodedClaims.has(this)) return decodedClaims.get(this);
if (!this.id_token) throw new Error('id_token not present in TokenSet');
const decoded = JSON.parse(base64url.decode(this.id_token.split('.')[1]));
decodedClaims.set(this, decoded);
return decoded;
}
}
module.exports = TokenSet;
{
"name": "openid-client",
"version": "1.1.0",
"version": "1.2.0",
"description": "OpenID Connect Relying Party (RP, Client) implementation for Node.js",

@@ -36,3 +36,3 @@ "main": "lib/index.js",

"eslint": "^3.0.0",
"eslint-config-airbnb-base": "^9.0.0",
"eslint-config-airbnb-base": "^10.0.1",
"eslint-plugin-import": "^2.0.1",

@@ -58,5 +58,5 @@ "istanbul": "^0.4.4",

"node-jose": "^0.9.0",
"uuid": "^3.0.0",
"oidc-token-hash": "^1.0.0"
"oidc-token-hash": "^1.0.0",
"uuid": "^3.0.0"
}
}

@@ -130,3 +130,4 @@ # openid-client

.then(function (tokenSet) {
console.log('received tokens %j', tokenSet);
console.log('received and validated tokens %j', tokenSet);
console.log('validated id_token claims %j' tokenSet.claims);
});

@@ -142,3 +143,4 @@ ```

.then(function (tokenSet) {
console.log('received tokens %j', tokenSet);
console.log('received and validated tokens %j', tokenSet);
console.log('validated id_token claims %j' tokenSet.claims);
});

@@ -175,3 +177,4 @@ ```

.then(function (tokenSet) {
console.log('refreshed tokens %j', tokenSet);
console.log('refreshed and validated tokens %j', tokenSet);
console.log('refreshed id_token claims %j' tokenSet.claims);
});

@@ -309,2 +312,19 @@ ```

### TokenSet
`authorizationCallback` and `refresh` methods on a Client return TokenSet, when assigned an
`expires_in` value a TokenSet calculates and assigns an `expires_at` with the corresponding unix
time. It also comes with few helpers.
```js
client.authorizationCallback(..., ...).then(function (tokenSet) {
console.log('tokenSet#expires_at', tokenSet.expires_at);
console.log('tokenSet#expires_in', tokenSet.expires_in);
setTimeout(function () {
console.log('tokenSet#expires_in', tokenSet.expires_in);
}, 2000);
console.log('tokenSet#expired()', tokenSet.expired());
console.log('tokenSet#claims', tokenSet.claims);
});
```
## Configuration

@@ -311,0 +331,0 @@

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