openid-client
Advanced tools
Comparing version 5.6.1 to 5.6.2
@@ -42,3 +42,6 @@ const assert = require('assert'); | ||
setDefaults([], { | ||
headers: { 'User-Agent': `${pkg.name}/${pkg.version} (${pkg.homepage})` }, | ||
headers: { | ||
'User-Agent': `${pkg.name}/${pkg.version} (${pkg.homepage})`, | ||
'Accept-Encoding': 'identity', | ||
}, | ||
timeout: 3500, | ||
@@ -45,0 +48,0 @@ }); |
@@ -141,32 +141,4 @@ const { inspect } = require('util'); | ||
static async discover(uri) { | ||
const parsed = url.parse(uri); | ||
const wellKnownUri = resolveWellKnownUri(uri); | ||
if (parsed.pathname.includes('/.well-known/')) { | ||
const response = await request.call(this, { | ||
method: 'GET', | ||
responseType: 'json', | ||
url: uri, | ||
headers: { | ||
Accept: 'application/json', | ||
}, | ||
}); | ||
const body = processResponse(response); | ||
return new Issuer({ | ||
...ISSUER_DEFAULTS, | ||
...body, | ||
[AAD_MULTITENANT]: !!AAD_MULTITENANT_DISCOVERY.find((discoveryURL) => | ||
uri.startsWith(discoveryURL), | ||
), | ||
}); | ||
} | ||
let pathname; | ||
if (parsed.pathname.endsWith('/')) { | ||
pathname = `${parsed.pathname}.well-known/openid-configuration`; | ||
} else { | ||
pathname = `${parsed.pathname}/.well-known/openid-configuration`; | ||
} | ||
const wellKnownUri = url.format({ ...parsed, pathname }); | ||
const response = await request.call(this, { | ||
@@ -205,2 +177,17 @@ method: 'GET', | ||
function resolveWellKnownUri(uri) { | ||
const parsed = url.parse(uri); | ||
if (parsed.pathname.includes('/.well-known/')) { | ||
return uri; | ||
} else { | ||
let pathname; | ||
if (parsed.pathname.endsWith('/')) { | ||
pathname = `${parsed.pathname}.well-known/openid-configuration`; | ||
} else { | ||
pathname = `${parsed.pathname}/.well-known/openid-configuration`; | ||
} | ||
return url.format({ ...parsed, pathname }); | ||
} | ||
} | ||
module.exports = Issuer; |
{ | ||
"name": "openid-client", | ||
"version": "5.6.1", | ||
"version": "5.6.2", | ||
"description": "OpenID Connect Relying Party (RP, Client) implementation for Node.js runtime, supports passportjs", | ||
@@ -48,3 +48,3 @@ "keywords": [ | ||
"dependencies": { | ||
"jose": "^4.15.1", | ||
"jose": "^4.15.4", | ||
"lru-cache": "^6.0.0", | ||
@@ -55,8 +55,8 @@ "object-hash": "^2.2.0", | ||
"devDependencies": { | ||
"@types/node": "^16.18.55", | ||
"@types/passport": "^1.0.13", | ||
"@types/node": "^16.18.59", | ||
"@types/passport": "^1.0.14", | ||
"base64url": "^3.0.1", | ||
"chai": "^4.3.10", | ||
"mocha": "^10.2.0", | ||
"nock": "^13.3.3", | ||
"nock": "^13.3.6", | ||
"prettier": "^2.8.8", | ||
@@ -63,0 +63,0 @@ "readable-mock-req": "^0.2.2", |
@@ -249,2 +249,20 @@ # openid-client | ||
### Client Credentials Grant Flow | ||
Client Credentials flow is for obtaining Access Tokens to use with third party APIs on behalf of your application, rather than an end-user which was the case in previous examples. | ||
**See the [documentation](./docs/README.md#clientgrantbody-extras) for full API details.** | ||
```js | ||
const client = new issuer.Client({ | ||
client_id: 'zELcpfANLqY7Oqas', | ||
client_secret: 'TQV5U29k1gHibH5bx1layBo0OSAvAbRT3UYW3EWrSYBB5swxjVfWUa1BS8lqzxG/0v9wruMcrGadany3', | ||
}); | ||
const tokenSet = await client.grant({ | ||
resource: 'urn:example:third-party-api', | ||
grant_type: 'client_credentials' | ||
}); | ||
``` | ||
## FAQ | ||
@@ -251,0 +269,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134768
324
3682
Updatedjose@^4.15.4