refactor: Improve incorrect deprecation log message for auth adapter (#8347)
This commit is contained in:
@@ -590,7 +590,7 @@ describe('AuthenticationProviders', function () {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can depreciate', async () => {
|
it('can deprecate', async () => {
|
||||||
await reconfigureServer();
|
await reconfigureServer();
|
||||||
const Deprecator = require('../lib/Deprecator/Deprecator');
|
const Deprecator = require('../lib/Deprecator/Deprecator');
|
||||||
const spy = spyOn(Deprecator, 'logRuntimeDeprecation').and.callFake(() => {});
|
const spy = spyOn(Deprecator, 'logRuntimeDeprecation').and.callFake(() => {});
|
||||||
@@ -598,8 +598,9 @@ describe('AuthenticationProviders', function () {
|
|||||||
Parse.User._registerAuthenticationProvider(provider);
|
Parse.User._registerAuthenticationProvider(provider);
|
||||||
await Parse.User._logInWith('myoauth');
|
await Parse.User._logInWith('myoauth');
|
||||||
expect(spy).toHaveBeenCalledWith({
|
expect(spy).toHaveBeenCalledWith({
|
||||||
usage: 'auth.myoauth',
|
usage: 'Using the authentication adapter "myoauth" without explicitly enabling it',
|
||||||
solution: 'auth.myoauth.enabled: true',
|
solution:
|
||||||
|
'Enable the authentication adapter by setting the Parse Server option "auth.myoauth.enabled: true".',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -435,8 +435,8 @@ const handleAuthDataValidation = async (authData, req, foundUser) => {
|
|||||||
const authProvider = (req.config.auth || {})[provider] || {};
|
const authProvider = (req.config.auth || {})[provider] || {};
|
||||||
if (authProvider.enabled == null) {
|
if (authProvider.enabled == null) {
|
||||||
Deprecator.logRuntimeDeprecation({
|
Deprecator.logRuntimeDeprecation({
|
||||||
usage: `auth.${provider}`,
|
usage: `Using the authentication adapter "${provider}" without explicitly enabling it`,
|
||||||
solution: `auth.${provider}.enabled: true`,
|
solution: `Enable the authentication adapter by setting the Parse Server option "auth.${provider}.enabled: true".`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!validator || authProvider.enabled === false) {
|
if (!validator || authProvider.enabled === false) {
|
||||||
|
|||||||
Reference in New Issue
Block a user