File tree 2 files changed +21
-10
lines changed
2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change 1
1
import loadAdapter from '../AdapterLoader' ;
2
2
import Parse from 'parse/node' ;
3
+ import AuthAdapter from './AuthAdapter' ;
3
4
4
5
const apple = require ( './apple' ) ;
5
6
const gcenter = require ( './gcenter' ) ;
@@ -153,22 +154,30 @@ function loadAuthAdapter(provider, authOptions) {
153
154
return ;
154
155
}
155
156
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
+ } ) ;
157
174
const appIds = providerOptions ? providerOptions . appIds : undefined ;
158
175
159
176
// Try the configuration methods
160
177
if ( providerOptions ) {
161
178
const optionalAdapter = loadAdapter ( providerOptions , undefined , providerOptions ) ;
162
179
if ( optionalAdapter ) {
163
- [
164
- 'validateAuthData' ,
165
- 'validateAppId' ,
166
- 'validateSetUp' ,
167
- 'validateLogin' ,
168
- 'validateUpdate' ,
169
- 'challenge' ,
170
- 'policy' ,
171
- ] . forEach ( key => {
180
+ keys . forEach ( key => {
172
181
if ( optionalAdapter [ key ] ) {
173
182
adapter [ key ] = optionalAdapter [ key ] ;
174
183
}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import RedisCacheAdapter from './Adapters/Cache/RedisCacheAdapter';
6
6
import LRUCacheAdapter from './Adapters/Cache/LRUCache.js' ;
7
7
import * as TestUtils from './TestUtils' ;
8
8
import * as SchemaMigrations from './SchemaMigrations/Migrations' ;
9
+ import AuthAdapter from './Adapters/Auth/AuthAdapter' ;
9
10
10
11
import { useExternal } from './deprecated' ;
11
12
import { getLogger } from './logger' ;
@@ -43,4 +44,5 @@ export {
43
44
ParseGraphQLServer ,
44
45
_ParseServer as ParseServer ,
45
46
SchemaMigrations ,
47
+ AuthAdapter ,
46
48
} ;
You can’t perform that action at this time.
0 commit comments