@@ -23,8 +23,7 @@ declare class OAuth2Server {
23
23
authenticate (
24
24
request : OAuth2Server . Request ,
25
25
response : OAuth2Server . Response ,
26
- options ?: OAuth2Server . AuthenticateOptions ,
27
- callback ?: OAuth2Server . Callback < OAuth2Server . Token >
26
+ options ?: OAuth2Server . AuthenticateOptions
28
27
) : Promise < OAuth2Server . Token > ;
29
28
30
29
/**
@@ -33,8 +32,7 @@ declare class OAuth2Server {
33
32
authorize (
34
33
request : OAuth2Server . Request ,
35
34
response : OAuth2Server . Response ,
36
- options ?: OAuth2Server . AuthorizeOptions ,
37
- callback ?: OAuth2Server . Callback < OAuth2Server . AuthorizationCode >
35
+ options ?: OAuth2Server . AuthorizeOptions
38
36
) : Promise < OAuth2Server . AuthorizationCode > ;
39
37
40
38
/**
@@ -43,8 +41,7 @@ declare class OAuth2Server {
43
41
token (
44
42
request : OAuth2Server . Request ,
45
43
response : OAuth2Server . Response ,
46
- options ?: OAuth2Server . TokenOptions ,
47
- callback ?: OAuth2Server . Callback < OAuth2Server . Token >
44
+ options ?: OAuth2Server . TokenOptions
48
45
) : Promise < OAuth2Server . Token > ;
49
46
}
50
47
@@ -238,11 +235,6 @@ declare namespace OAuth2Server {
238
235
extendedGrantTypes ?: { [ key : string ] : typeof AbstractGrantType } | undefined ;
239
236
}
240
237
241
- /**
242
- * Represents a generic callback structure for model callbacks
243
- */
244
- type Callback < T > = ( err ?: any , result ?: T ) => void ;
245
-
246
238
/**
247
239
* For returning falsey parameters in cases of failure
248
240
*/
@@ -253,53 +245,53 @@ declare namespace OAuth2Server {
253
245
* Invoked to generate a new access token.
254
246
*
255
247
*/
256
- generateAccessToken ?( client : Client , user : User , scope : string | string [ ] , callback ?: Callback < string > ) : Promise < string > ;
248
+ generateAccessToken ?( client : Client , user : User , scope : string | string [ ] ) : Promise < string > ;
257
249
258
250
/**
259
251
* Invoked to retrieve a client using a client id or a client id/client secret combination, depending on the grant type.
260
252
*
261
253
*/
262
- getClient ( clientId : string , clientSecret : string , callback ?: Callback < Client | Falsey > ) : Promise < Client | Falsey > ;
254
+ getClient ( clientId : string , clientSecret : string ) : Promise < Client | Falsey > ;
263
255
264
256
/**
265
257
* Invoked to save an access token and optionally a refresh token, depending on the grant type.
266
258
*
267
259
*/
268
- saveToken ( token : Token , client : Client , user : User , callback ?: Callback < Token > ) : Promise < Token | Falsey > ;
260
+ saveToken ( token : Token , client : Client , user : User ) : Promise < Token | Falsey > ;
269
261
}
270
262
271
263
interface RequestAuthenticationModel {
272
264
/**
273
265
* Invoked to retrieve an existing access token previously saved through Model#saveToken().
274
266
*
275
267
*/
276
- getAccessToken ( accessToken : string , callback ?: Callback < Token > ) : Promise < Token | Falsey > ;
268
+ getAccessToken ( accessToken : string ) : Promise < Token | Falsey > ;
277
269
278
270
/**
279
271
* Invoked during request authentication to check if the provided access token was authorized the requested scopes.
280
272
*
281
273
*/
282
- verifyScope ( token : Token , scope : string | string [ ] , callback ?: Callback < boolean > ) : Promise < boolean > ;
274
+ verifyScope ( token : Token , scope : string | string [ ] ) : Promise < boolean > ;
283
275
}
284
276
285
277
interface AuthorizationCodeModel extends BaseModel , RequestAuthenticationModel {
286
278
/**
287
279
* Invoked to generate a new refresh token.
288
280
*
289
281
*/
290
- generateRefreshToken ?( client : Client , user : User , scope : string | string [ ] , callback ?: Callback < string > ) : Promise < string > ;
282
+ generateRefreshToken ?( client : Client , user : User , scope : string | string [ ] ) : Promise < string > ;
291
283
292
284
/**
293
285
* Invoked to generate a new authorization code.
294
286
*
295
287
*/
296
- generateAuthorizationCode ?( client : Client , user : User , scope : string | string [ ] , callback ?: Callback < string > ) : Promise < string > ;
288
+ generateAuthorizationCode ?( client : Client , user : User , scope : string | string [ ] ) : Promise < string > ;
297
289
298
290
/**
299
291
* Invoked to retrieve an existing authorization code previously saved through Model#saveAuthorizationCode().
300
292
*
301
293
*/
302
- getAuthorizationCode ( authorizationCode : string , callback ?: Callback < AuthorizationCode > ) : Promise < AuthorizationCode | Falsey > ;
294
+ getAuthorizationCode ( authorizationCode : string ) : Promise < AuthorizationCode | Falsey > ;
303
295
304
296
/**
305
297
* Invoked to save an authorization code.
@@ -308,20 +300,20 @@ declare namespace OAuth2Server {
308
300
saveAuthorizationCode (
309
301
code : Pick < AuthorizationCode , 'authorizationCode' | 'expiresAt' | 'redirectUri' | 'scope' | 'codeChallenge' | 'codeChallengeMethod' > ,
310
302
client : Client ,
311
- user : User ,
312
- callback ?: Callback < AuthorizationCode > ) : Promise < AuthorizationCode | Falsey > ;
303
+ user : User
304
+ ) : Promise < AuthorizationCode | Falsey > ;
313
305
314
306
/**
315
307
* Invoked to revoke an authorization code.
316
308
*
317
309
*/
318
- revokeAuthorizationCode ( code : AuthorizationCode , callback ?: Callback < boolean > ) : Promise < boolean > ;
310
+ revokeAuthorizationCode ( code : AuthorizationCode ) : Promise < boolean > ;
319
311
320
312
/**
321
313
* Invoked to check if the requested scope is valid for a particular client/user combination.
322
314
*
323
315
*/
324
- validateScope ?( user : User , client : Client , scope : string | string [ ] , callback ?: Callback < string | Falsey > ) : Promise < string | string [ ] | Falsey > ;
316
+ validateScope ?( user : User , client : Client , scope : string | string [ ] ) : Promise < string | string [ ] | Falsey > ;
325
317
326
318
/**
327
319
* Invoked to check if the provided `redirectUri` is valid for a particular `client`.
@@ -335,53 +327,53 @@ declare namespace OAuth2Server {
335
327
* Invoked to generate a new refresh token.
336
328
*
337
329
*/
338
- generateRefreshToken ?( client : Client , user : User , scope : string | string [ ] , callback ?: Callback < string > ) : Promise < string > ;
330
+ generateRefreshToken ?( client : Client , user : User , scope : string | string [ ] ) : Promise < string > ;
339
331
340
332
/**
341
333
* Invoked to retrieve a user using a username/password combination.
342
334
*
343
335
*/
344
- getUser ( username : string , password : string , callback ?: Callback < User | Falsey > ) : Promise < User | Falsey > ;
336
+ getUser ( username : string , password : string ) : Promise < User | Falsey > ;
345
337
346
338
/**
347
339
* Invoked to check if the requested scope is valid for a particular client/user combination.
348
340
*
349
341
*/
350
- validateScope ?( user : User , client : Client , scope : string | string [ ] , callback ?: Callback < string | Falsey > ) : Promise < string | string [ ] | Falsey > ;
342
+ validateScope ?( user : User , client : Client , scope : string | string [ ] ) : Promise < string | string [ ] | Falsey > ;
351
343
}
352
344
353
345
interface RefreshTokenModel extends BaseModel , RequestAuthenticationModel {
354
346
/**
355
347
* Invoked to generate a new refresh token.
356
348
*
357
349
*/
358
- generateRefreshToken ?( client : Client , user : User , scope : string | string [ ] , callback ?: Callback < string > ) : Promise < string > ;
350
+ generateRefreshToken ?( client : Client , user : User , scope : string | string [ ] ) : Promise < string > ;
359
351
360
352
/**
361
353
* Invoked to retrieve an existing refresh token previously saved through Model#saveToken().
362
354
*
363
355
*/
364
- getRefreshToken ( refreshToken : string , callback ?: Callback < RefreshToken > ) : Promise < RefreshToken | Falsey > ;
356
+ getRefreshToken ( refreshToken : string ) : Promise < RefreshToken | Falsey > ;
365
357
366
358
/**
367
359
* Invoked to revoke a refresh token.
368
360
*
369
361
*/
370
- revokeToken ( token : RefreshToken | Token , callback ?: Callback < boolean > ) : Promise < boolean > ;
362
+ revokeToken ( token : RefreshToken | Token ) : Promise < boolean > ;
371
363
}
372
364
373
365
interface ClientCredentialsModel extends BaseModel , RequestAuthenticationModel {
374
366
/**
375
367
* Invoked to retrieve the user associated with the specified client.
376
368
*
377
369
*/
378
- getUserFromClient ( client : Client , callback ?: Callback < User | Falsey > ) : Promise < User | Falsey > ;
370
+ getUserFromClient ( client : Client ) : Promise < User | Falsey > ;
379
371
380
372
/**
381
373
* Invoked to check if the requested scope is valid for a particular client/user combination.
382
374
*
383
375
*/
384
- validateScope ?( user : User , client : Client , scope : string | string [ ] , callback ?: Callback < string | Falsey > ) : Promise < string | string [ ] | Falsey > ;
376
+ validateScope ?( user : User , client : Client , scope : string | string [ ] ) : Promise < string | string [ ] | Falsey > ;
385
377
}
386
378
387
379
interface ExtensionModel extends BaseModel , RequestAuthenticationModel { }
0 commit comments