Commit Graph
204 Commits
Author SHA1 Message Date
Filip Skokan 6c963e0b95 fix: recognize N_A in the token exchange grant 2025-08-12 11:46:43 +02:00
Filip Skokan aa064fc101 test: more discovery coverage 2025-08-06 19:34:55 +02:00
Filip Skokan 88bffd1c58 fix: allow client secret based auth factories to be used with DCR 2025-04-03 20:14:45 +02:00
Filip Skokan 184c314980 feat: add support for Dynamic Client Registration 2025-04-03 17:44:07 +02:00
Filip Skokan 99d3a27abb test: add a test for ensuring 30x non-conform behaviours can be worked around 2024-10-23 23:46:01 +02:00
Filip Skokan ccf58c20e1 fix: deal with discovery issues from b2clogin.com
fixes #718
2024-10-23 23:46:01 +02:00
Filip Skokan 84d3c9c3a8 test: add regression test for issue 704 2024-10-23 23:14:56 +02:00
Filip Skokan 53927452eb refactor!: openid-client@6
BREAKING CHANGE: openid-client v6.x is a complete rewrite of the openid-client module, this is the first time since 0.1.0 (8 years ago) that the API has drastically changed. The new module structure and API focuses on three core principles:

- runtime compatibility (adding support for Deno, Cloudflare Workers, Bun, and other Web API interoperable runtimes)
- tree-shakeability (bundles should not contain features that don't end up being used)
- less options (removing support for processing deprecated response types, cutting down on the number of combinations that need to handled)

To that end openid-client@6 no longer supports the full cartesian matrix of response types and response modes, it no longer supports issuing encrypted assertions, decrypting assertions is limited to only a few algorithms, it no longer supports Dynamic Client Registration or Management, and Self-Issued OpenID Provider responses are also not supported.

The new API makes basic setups simple while allowing some degree of complexity where needed.

openid-client@6 is an ESM module using ES2022 syntax and it depends on WebCryptoAPI and Fetch API globals being available in the JS runtime.

openid-client@6 is written in TypeScript and its exported types come with comment annotations.

(Node.js) Versions 20.x and newer have all the necessary globals.

(Node.js) CJS style `let client = require('openid-client')` is possible in versions where `process.features.require_module` is `true`. This is a new Node.js feature slated to be released without a CLI flag in 23.x and 22.x
2024-10-15 23:58:32 +02:00
Filip Skokan 57865f4ea0 fix: include DPoP Proof "htm" in requestResource if GET is defaulted to 2024-09-09 14:22:26 +02:00
Filip Skokan 93ae08dfd5 Revert "fix: encode client_secret_basic - _ . ! ~ * ' ( ) characters"
This reverts commit 478cb2bc65, even
though it is the correct implementation some of the most widely used
identity providers don't follow the specification.
2024-01-06 11:00:21 +01:00
Filip Skokan 478cb2bc65 fix: encode client_secret_basic - _ . ! ~ * ' ( ) characters
Because encodeURIComponent() encodes everything except alphanumericals
and `- _ . ! ~ * ' ( )` these need to be encoded explicitly similar to
how the resulting `%20' is replaced with '+'

This is as per RFC6749 Section 2.3.1 and Appendix B
2024-01-05 15:34:55 +01:00
Filip Skokan 0b65130989 fix: add explicit Accept-Encoding header to http requests
fixes #648
2023-12-22 12:16:25 +01:00
56andGitHub 66fe136d21 fix: consistent space encoding in authorizationUrl (#627)
Fixes #626
2023-10-11 14:15:07 +02:00
Filip Skokan f0d95390e9 feat: experimental Bun support
This attempts to work around:

- missing Node.js APIs in Bun
- Bun's bugs in url.parse(..., true)
- Bun loading `jose`'s bun target instead of the require one

It is not possible to run openid-client's test suite due to other Bun
Node.js compatibility bugs which is why this is "experimental"

Refs #622
Refs #623
2023-10-03 16:58:50 +02:00
ExidexandGitHub 9641185a21 fix: handle empty client_secret with basic and post client auth (#610)
closes #609
2023-07-06 11:11:13 +02:00
Filip Skokan a6ea43e816 feat: allow third party initiated login requests to trigger strategy
closes #510
closes #564
2023-02-05 17:51:19 +01:00
Filip Skokan fb89856a8b chore: fixup e632a56 2023-01-20 13:06:58 +01:00
Filip Skokan 53b10c5ced Revert "ci: skip flaky on CITGM"
This reverts commit 36b1122192.
2022-10-20 17:29:17 +02:00
Filip Skokan 36b1122192 ci: skip flaky on CITGM 2022-10-20 17:21:22 +02:00
Filip Skokan 15b1a19d4e fix: allow endSessionUrl defaults to be overriden 2022-10-19 11:10:28 +02:00
Filip Skokan 9d5ed50864 feat: add client_id to endSessionUrl query strings 2022-10-19 10:55:57 +02:00
Filip Skokan 2ae1a85ffe fix: safeguard TokenSet prototype methods
closes #511
2022-08-23 15:24:08 +02:00
Filip Skokan 566277898b test: refactor json parse failure err matching 2022-08-04 15:42:25 +02:00
Filip Skokan f9b4659318 fix: ignore non-conform "unrecognized" id_token in oauthCallback()
fixes #503
2022-07-04 10:47:10 +02:00
Filip Skokan d8609a6fc1 fix: interoperable audience array value for JWT Client auth assertions (again)
- token endpoint is a SHOULD in all definitions
- issuer identifier is the defacto identifier that should be accepted too
- specific endpoint location is not defined anywhere
2022-04-14 14:29:10 +02:00
Frederik EichlerandGitHub 0782cea0e7 fix: add application/jwk-set+json to accept header for JWKS calls (#467)
Closes #466
2022-02-03 14:43:14 +01:00
Filip Skokan f47feec644 fix: passing null as checks.nonce should not disable it 2022-01-13 22:56:48 +01:00
Filip Skokan 0b8e41f04b feat: support server-provided DPoP nonces (update DPoP to draft-04) 2021-12-03 12:35:10 +01:00
Filip Skokan fbc4fffe68 fix: reject oauthCallback when id_token is detected 2021-12-03 11:55:24 +01:00
Filip Skokan 5620b55ecf feat: support OAuth 2.0 Authorization Server Issuer Identification
Added support for
[draft-ietf-oauth-iss-auth-resp](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-iss-auth-resp-04)
2021-12-03 11:49:33 +01:00
Filip Skokan 61d9060bde chore: bump jose 2021-11-01 18:52:21 +01:00
Hitko DevelopmentandGitHub 8f5c1858a1 fix: explicitly set content-length again
Closes #420
Co-authored-by: Filip Skokan <[email protected]>
2021-10-28 21:04:02 +02:00
Filip Skokan 40f1c3e09f fix: explicitly set accept: application/json again 2021-10-27 15:29:09 +02:00
Filip Skokan 1060959de8 refactor: more use of private syntax 2021-10-27 14:08:27 +02:00
Filip Skokan 14a59753a2 refactor: remove the 'query' option for userinfo, assert access token
BREAKING CHANGE: The 'query' way of passing access token to userinfo
was removed.

BREAKING CHANGE: Access Token is now asserted to be present for the
userinfo call.
2021-10-27 14:08:27 +02:00
Filip Skokan d63d0b6efa style: eslint -, prettier + 2021-10-27 14:08:26 +02:00
Filip Skokan 6d4b04f995 refactor: truly private functions, concurrent jwks_uri fetch, make-error 2021-10-27 14:08:26 +02:00
Filip Skokan 70772ea31e refactor: FAPIClient is renamed to FAPI1Client
BREAKING CHANGE: FAPIClient is renamed to FAPI1Client
BREAKING CHANGE: FAPI1Client has default algorithms set to PS256 rather
than RS256
BREAKING CHANGE: FAPI1Client has default tls_client_certificate_bound_access_tokens
set to true
BREAKING CHANGE: FAPI1Client has default response_types set to
`id_token code` and grant_types accordingly
BREAKING CHANGE: FAPI1Client has no token_endpoint_auth_method set,
one must be set explicitly
2021-10-27 14:08:25 +02:00
Filip Skokan d602726eea chore: revert use of quick-lru 2021-10-27 14:08:25 +02:00
Filip Skokan 156546e6bc refactor: remove generic "typ": "JWT" header parameters 2021-10-27 14:08:25 +02:00
Filip Skokan a8ad34dedd refactor: remove client.unpackAggregatedClaims and client.fetchDistributedClaims
BREAKING CHANGE: Client methods `unpackAggregatedClaims` and `fetchDistributedClaims`
were removed with no replacement.
2021-10-27 14:08:25 +02:00
Filip Skokan c030aefee0 refactor: update runtime to use jose@4 2021-10-27 14:08:24 +02:00
Filip Skokan bb0f47fca1 refactor: DPoP input must be a private KeyObject or valid crypto.createPrivateKey input
BREAKING CHANGE: DPoP option inputs must be a private crypto.KeyObject
or a valid crypto.createPrivateKey input.
2021-10-27 14:08:24 +02:00
Filip Skokan dea5ab4ccf refactor: only use the native http(s) client
BREAKING CHANGE: HTTP(S) request customization now only recognizes the
following options 'agent', 'ca', 'cert', 'crl', 'headers', 'key',
'lookup', 'passphrase', 'pfx', and 'timeout'. These are standard node
http/https module request options, got-library specific options such
as 'followRedirect', 'retry', or 'throwHttpErrors' are no longer
recognized.

BREAKING CHANGE: The arguments inside individual HTTP request
customization changed, first argument is now an instance of
[URL](https://nodejs.org/api/url.html#class-url), the http request options object is passed in as a second
argument.

BREAKING CHANGE: The `response` property attached to some RPError or
OPError instances is now an instance of [http.IncomingMessage](https://nodejs.org/api/http.html#class-httpincomingmessage). Its
body is available on its `body` property as either JSON if it could be
parsed, or a Buffer if it failed to pass as JSON.
2021-10-27 14:08:24 +02:00
Filip Skokan 8bc1c428fb refactor: remove automatic lookup of /.well-known/oauth-authorization-server
BREAKING CHANGE: Issuer.discover will no longer attempt to load
`/.well-known/oauth-authorization-server`. To load such discovery
documents pass full well-known URL to Issuer.discover.
2021-10-24 15:35:48 +02:00
Filip Skokan 39342e5ec7 fix: do not implicitly calculate key ids for Client instances
closes #379
2021-10-13 16:15:40 +02:00
1fadc33eae feat: update DPoP support to draft-03 (#407)
Resolves #406 

Co-authored-by: Richard L. Barnes <[email protected]>
Co-authored-by: Filip Skokan <[email protected]>
2021-09-20 22:19:46 +02:00
Filip Skokan b5fd8320bc fix(fapi): validate ID Token's iat regardless of which channel it came from 2021-04-30 13:58:13 +02:00
Filip SkokanandGitHub 7ef4e5a752 feat: add abort control over Device Flow Handle polling (#357)
Example using AbortController.

```js
const ac = new AbortController()

setTimeout(() => ac.abort(), 10000)

try {
  await handle.poll({ signal: ac.signal })
} catch (err) {
  console.log(err)
}
```

Example using handle.abort().

```js
setTimeout(() => handle.abort(), 10000)

try {
  await handle.poll({ signal: ac.signal })
} catch (err) {
  console.log(err)
}
```

resolves #355
closes #356
2021-04-22 17:21:45 +02:00
Filip Skokan 120c1ef7ab refactor: only include mtls alias for token endpoint when mtls tokens are issued 2021-03-26 10:49:24 +01:00