@bedrock/authn-token
Advanced tools
Comparing version 10.1.0 to 10.2.0
# bedrock-authn-token ChangeLog | ||
## 10.2.0 - 2022-05-28 | ||
### Added | ||
- Allow default `requiredAuthenticationMethods` to be configured via a new | ||
bedrock configuration option `defaultRequiredAuthenticationMethods`. If | ||
a non-empty array of strings is set as the config option value, then new | ||
accounts that do not have any `requiredAuthenticationMethods` set will | ||
receive the value. This feature is backwards compatible and makes no | ||
changes by default. It enables applications to avoid having to make an | ||
extra call during account registration to setup default required | ||
authentication methods. | ||
## 10.1.0 - 2022-05-22 | ||
@@ -4,0 +16,0 @@ |
@@ -9,4 +9,23 @@ /*! | ||
const {util: {BedrockError}} = bedrock; | ||
const {config, util: {BedrockError}} = bedrock; | ||
bedrock.events.on('bedrock-account.insert', ({meta}) => { | ||
// get default `requiredAuthenticationMethods` | ||
const {'authn-token': cfg} = config; | ||
if(cfg.defaultRequiredAuthenticationMethods.length === 0) { | ||
// no defaults | ||
return; | ||
} | ||
// set default `requiredAuthenticationMethods` if none already set on account | ||
let brAuthnTokenMeta = meta['bedrock-authn-token']; | ||
if(!brAuthnTokenMeta) { | ||
brAuthnTokenMeta = meta['bedrock-authn-token'] = {}; | ||
} | ||
if(!brAuthnTokenMeta.requiredAuthenticationMethods) { | ||
brAuthnTokenMeta.requiredAuthenticationMethods = | ||
cfg.defaultRequiredAuthenticationMethods.slice(); | ||
} | ||
}); | ||
/** | ||
@@ -13,0 +32,0 @@ * Sets required authentication methods for an account. |
@@ -8,2 +8,6 @@ /*! | ||
// an array of strings like 'login-email-challenge' that will be added to | ||
// new accounts if no other `requiredAuthenticationMethods` are set | ||
cfg.defaultRequiredAuthenticationMethods = []; | ||
cfg.pbkdf2 = { | ||
@@ -10,0 +14,0 @@ id: 'pbkdf2-sha512', |
{ | ||
"name": "@bedrock/authn-token", | ||
"version": "10.1.0", | ||
"version": "10.2.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Simple token-based authentication for Bedrock apps", |
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
114983
2895