File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
test/integration/handlers Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -332,6 +332,50 @@ describe('AuthorizeHandler integration', function() {
332332 } ) ;
333333 } ) ;
334334
335+ it ( 'should redirect to a successful response if `model.validateScope` is not defined' , function ( ) {
336+ var client = { grants : [ 'authorization_code' ] , redirectUris : [ 'http://example.com/cb' ] } ;
337+ var model = {
338+ getAccessToken : function ( ) {
339+ return {
340+ client : client ,
341+ user : { } ,
342+ accessTokenExpiresAt : new Date ( new Date ( ) . getTime ( ) + 10000 )
343+ } ;
344+ } ,
345+ getClient : function ( ) {
346+ return client ;
347+ } ,
348+ saveAuthorizationCode : function ( ) {
349+ return { authorizationCode : 12345 , client : client } ;
350+ }
351+ } ;
352+ var handler = new AuthorizeHandler ( { authorizationCodeLifetime : 120 , model : model } ) ;
353+ var request = new Request ( {
354+ body : {
355+ client_id : 12345 ,
356+ response_type : 'code'
357+ } ,
358+ headers : {
359+ 'Authorization' : 'Bearer foo'
360+ } ,
361+ method : { } ,
362+ query : {
363+ scope : 'read' ,
364+ state : 'foobar'
365+ }
366+ } ) ;
367+ var response = new Response ( { body : { } , headers : { } } ) ;
368+
369+ return handler . handle ( request , response )
370+ . then ( function ( data ) {
371+ data . should . eql ( {
372+ authorizationCode : 12345 ,
373+ client : client
374+ } ) ;
375+ } )
376+ . catch ( should . fail ) ;
377+ } ) ;
378+
335379 it ( 'should redirect to an error response if `scope` is insufficient' , function ( ) {
336380 var client = { grants : [ 'authorization_code' ] , redirectUris : [ 'http://example.com/cb' ] } ;
337381 var model = {
You can’t perform that action at this time.
0 commit comments