Skip to content

Commit

Permalink
refactor: remove provider.initialize()
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `provider.initialize()` has been removed.

BREAKING CHANGE: what was previously passed to `initialize()` as
`keystore` must now be passed as configuration property (as `jwks` and
it must be a JWKS formatted object, no longer a KeyStore instance.

BREAKING CHANGE: what was previously passed to `initialize()` as
`clients` must now be passed as configuration property (as `clients`)
and may not contain `sector_identifier_uri`,

BREAKING CHANGE: what was previously passed to `initialize()` as
`adapter` must now be passed as configuration property (as `adapter`).

BREAKING CHANGE: provider will no longer call `adapter`'s `connect`
method.
  • Loading branch information
panva committed Apr 18, 2019
1 parent f433cf4 commit ec71ed0
Show file tree
Hide file tree
Showing 40 changed files with 661 additions and 756 deletions.
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ id_token_hint. See https://bitbucket.org/openid/connect/issues/1032
or has the appropriate back/front channel logout uris enabled and front/backchannel_logout_session_required
set to true
- the provider now uses `@panva/jose` module instead `node-jose`, this module brings in improvements
in JWS/JWE performance due to it's use of `KeyObject` API introduced in Node.js v11.6.0
in JWS/JWE performance due to its use of `KeyObject` API introduced in Node.js v11.6.0
- clients with `request_object_signing_alg` set must now always provide a request object,
authorization requests will fail with `invalid_request` when `request` or `request_uri` is missing
for such clients
Expand All @@ -167,7 +167,9 @@ id_token_hint. See https://bitbucket.org/openid/connect/issues/1032
with its matching value in the `grantId` property
- only `AccessToken` and `ClientCredentials` may have a format. All other tokens are now forced to
be opaque
- `clientCacheDuration` configuration option has been removed
- `clientCacheDuration` configuration option and `provider.Client.cacheClear` method have been
removed, the provider now handles everything internally and Client objects are re-instantiated
automatically if the client's configuration changes.
- `token.*` events are no longer emitted, instead each token has its own event, sessions and
interactions too, the convention is `snake_cased_model_name.*`
- `features.pkce` and `features.oauthNativeApps` are now not configurable and always in effect, pkce
Expand All @@ -178,7 +180,7 @@ id_token_hint. See https://bitbucket.org/openid/connect/issues/1032
- `features.refreshTokenRotation` has been renamed to `features.rotateRefreshToken` and its values
are now true/false or a function that returns true/false when a refresh token should or should not
be rotated
- `features.conformIdTokenClaims` is not a feature anymore, it's just `conformIdTokenClaims` in the
- `features.conformIdTokenClaims` is not a feature anymore, it is just `conformIdTokenClaims` in the
configuration object's root
- revoking an Access Token via the `revocation_endpoint` will not revoke the whole grant any more
- default `interaction` cookie name value changed from `_grant` to `_interaction`
Expand Down Expand Up @@ -453,7 +455,7 @@ renaming of a configuration value, while the `unsupported` option was
essentually a blacklist the `whitelistedJWA` as the name suggests is a
whitelist.
* the `RSA-OAEP-256` key wrapping algorithm has been
removed and is not configurable since it's not supported natively in
removed and is not configurable since it is not supported natively in
nodejs.
* IdToken constructor now requires the client instance
to be passed in as a second argument. IdToken instance `.sign()` now
Expand Down
42 changes: 17 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ See [v5.x](https://github.com/panva/node-oidc-provider/tree/v5.x) for the last v
- [Implemented specs & features](#implemented-specs--features)
- [Certification](#certification)
- [Get started](#get-started)
- [Configuration and Initialization](#configuration-and-initialization)
- [Configuration](#configuration)
- [Debugging](#debugging)
- [Events](#events)

Expand Down Expand Up @@ -110,41 +110,33 @@ there. An example client using this provider is available [here][heroku-exampl
Also be sure to check the available configuration docs section.


## Configuration and Initialization
## Configuration
oidc-provider allows to be extended and configured in various ways to fit a variety of uses. See
the [available configuration](/docs).

```js
const Provider = require('oidc-provider');
const configuration = {
// ... see available options /docs
clients: [{
client_id: 'foo',
client_secret: 'bar',
redirect_uris: ['http://lvh.me:8080/cb'],
// + other client properties
}],
};
const clients = [{
client_id: 'foo',
client_secret: 'bar',
redirect_uris: ['http://lvh.me:8080/cb'],
// + other client properties
}];

const oidc = new Provider('http://localhost:3000', configuration);

let server;
(async () => {
await oidc.initialize({ clients });
// express/nodejs style application callback (req, res, next) for use with express apps, see /examples/express.js
oidc.callback

// koa application for use with koa apps, see /examples/koa.js
oidc.app

// or just expose a server standalone, see /examples/standalone.js
server = oidc.listen(3000, () => {
console.log('oidc-provider listening on port 3000, check http://localhost:3000/.well-known/openid-configuration');
});
})().catch((err) => {
if (server && server.listening) server.close();
console.error(err);
process.exitCode = 1;
// express/nodejs style application callback (req, res, next) for use with express apps, see /examples/express.js
oidc.callback

// koa application for use with koa apps, see /examples/koa.js
oidc.app

// or just expose a server standalone, see /examples/standalone.js
const server = oidc.listen(3000, () => {
console.log('oidc-provider listening on port 3000, check http://localhost:3000/.well-known/openid-configuration');
});
```

Expand Down
Loading

0 comments on commit ec71ed0

Please sign in to comment.