Skip to content

Commit eaff3b1

Browse files
authored
Merge 7e8306c into 656bca6
2 parents 656bca6 + 7e8306c commit eaff3b1

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

Diff for: src/Adapters/Auth/index.js

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import loadAdapter from '../AdapterLoader';
22
import Parse from 'parse/node';
3+
import AuthAdapter from './AuthAdapter';
34

45
const apple = require('./apple');
56
const gcenter = require('./gcenter');
@@ -153,22 +154,30 @@ function loadAuthAdapter(provider, authOptions) {
153154
return;
154155
}
155156

156-
const adapter = Object.assign({}, defaultAdapter);
157+
const adapter = defaultAdapter instanceof AuthAdapter ? defaultAdapter : Object.assign({}, defaultAdapter);
158+
const keys = [
159+
'validateAuthData',
160+
'validateAppId',
161+
'validateSetUp',
162+
'validateLogin',
163+
'validateUpdate',
164+
'challenge',
165+
'policy'
166+
];
167+
const defaultAuthAdapter = new AuthAdapter();
168+
keys.forEach(key => {
169+
const existing = adapter?.[key];
170+
if (existing && typeof existing === 'function' && existing.toString() === defaultAuthAdapter[key].toString()) {
171+
adapter[key] = null;
172+
}
173+
});
157174
const appIds = providerOptions ? providerOptions.appIds : undefined;
158175

159176
// Try the configuration methods
160177
if (providerOptions) {
161178
const optionalAdapter = loadAdapter(providerOptions, undefined, providerOptions);
162179
if (optionalAdapter) {
163-
[
164-
'validateAuthData',
165-
'validateAppId',
166-
'validateSetUp',
167-
'validateLogin',
168-
'validateUpdate',
169-
'challenge',
170-
'policy',
171-
].forEach(key => {
180+
keys.forEach(key => {
172181
if (optionalAdapter[key]) {
173182
adapter[key] = optionalAdapter[key];
174183
}

Diff for: src/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import RedisCacheAdapter from './Adapters/Cache/RedisCacheAdapter';
66
import LRUCacheAdapter from './Adapters/Cache/LRUCache.js';
77
import * as TestUtils from './TestUtils';
88
import * as SchemaMigrations from './SchemaMigrations/Migrations';
9+
import AuthAdapter from './Adapters/Auth/AuthAdapter';
910

1011
import { useExternal } from './deprecated';
1112
import { getLogger } from './logger';
@@ -43,4 +44,5 @@ export {
4344
ParseGraphQLServer,
4445
_ParseServer as ParseServer,
4546
SchemaMigrations,
47+
AuthAdapter,
4648
};

0 commit comments

Comments
 (0)