File tree Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change 11import loadAdapter from '../AdapterLoader' ;
22import Parse from 'parse/node' ;
3+ import AuthAdapter from './AuthAdapter' ;
34
45const apple = require ( './apple' ) ;
56const 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 }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import RedisCacheAdapter from './Adapters/Cache/RedisCacheAdapter';
66import LRUCacheAdapter from './Adapters/Cache/LRUCache.js' ;
77import * as TestUtils from './TestUtils' ;
88import * as SchemaMigrations from './SchemaMigrations/Migrations' ;
9+ import AuthAdapter from './Adapters/Auth/AuthAdapter' ;
910
1011import { useExternal } from './deprecated' ;
1112import { getLogger } from './logger' ;
@@ -43,4 +44,5 @@ export {
4344 ParseGraphQLServer ,
4445 _ParseServer as ParseServer ,
4546 SchemaMigrations ,
47+ AuthAdapter ,
4648} ;
You can’t perform that action at this time.
0 commit comments