Skip to content

v3.0.0

Compare
Choose a tag to compare
@jasonraimondi jasonraimondi released this 08 Jun 02:40
· 174 commits to main since this release
a3d4bb0

Notes

  • The package is now entirely ESM (ECMAScript Modules), check out Sindre Sorhus's writeup for a better understanding of this change.
  • The AuthorizationServer default constructor's parameters have been simplified.
  • The AuthorizationServerOptions default configuration values for have been changed.
  • The AuthorizationServer.enableGrantType() process to enable grant types has been updated.
  • The AuthorizationServer.setOptions() method has been removed. Options should be set during initialization.

Migration

[migration guide]

AuthorizationServer Updates

In v2.x, AuthorizationServer constructor required all repositories. In v3.x, it has been simplified.

Before (v2.x):

const authorizationServer = new AuthorizationServer(
  authCodeRepository,
  clientRepository,
  accessTokenRepository,
  scopeRepository,
  userRepository,
  jwtService,
  {
    requiresS256: false, 
    tokenCID: "name",
  }
);

After (v3.x):

const authorizationServer = new AuthorizationServer(
  clientRepository,
  accessTokenRepository,
  scopeRepository,
  jwtService,
  {
    requiresS256: true,  // default changed to true
    tokenCID: "id",      // default changed to "id"
  }
);

Enabling Grants

In v3, enableGrantType has been updated for the "authorization_code" and "password" grants.

AuthorizationCodeGrant now requires a AuthorizationCodeRepository and a UserRepository.

Before (v2.x):

authorizationServer.enableGrantType("authorization_code");

After (v3.x):

authorizationServer.enableGrantType({
  grant: "authorization_code",
  userRepository, 
  authorizationCodeRepository,
});

PasswordGrant now requires a UserRepository.

Before (v2.x):

authorizationServer.enableGrantType("password");

After (v3.x):

authorizationServer.enableGrantType({
  grant: "password",
  userRepository, 
});

Callouts

Thanks to @mahmoudzeyada

Full Changelog

v2.6.1...v3.0.0