@@ -373,20 +373,31 @@ describe('Client metadata validation', () => {
373373 defaultsTo ( this . title , [ 'authorization_code' ] ) ;
374374 mustBeArray ( this . title ) ;
375375 allows ( this . title , [ 'authorization_code' , 'refresh_token' ] ) ;
376+ allows ( this . title , [ ] , { response_types : [ 'none' ] } ) ;
376377 rejects ( this . title , [ 123 ] , / m u s t o n l y c o n t a i n s t r i n g s $ / ) ;
377- rejects ( this . title , [ ] ) ;
378378 rejects ( this . title , [ 'not-a-type' ] ) ;
379- rejects ( this . title , [ 'implicit' ] , undefined , {
379+
380+ // grant types auto-fixup
381+ allows ( this . title , [ ] , undefined , undefined , ( client ) => {
382+ expect ( client . metadata ( ) ) . to . have . property ( 'grant_types' ) . and . deep . eql ( [ 'authorization_code' ] ) ;
383+ } ) ;
384+ allows ( this . title , [ 'implicit' ] , {
380385 // misses authorization_code
381386 response_types : [ 'id_token' , 'code' ] ,
387+ } , undefined , ( client ) => {
388+ expect ( client . metadata ( ) ) . to . have . property ( 'grant_types' ) . and . deep . eql ( [ 'implicit' , 'authorization_code' ] ) ;
382389 } ) ;
383- rejects ( this . title , [ 'authorization_code' ] , undefined , {
384- // misses implicit
390+ allows ( this . title , [ 'authorization_code' ] , {
391+ // misses code in response_types
385392 response_types : [ 'id_token' ] ,
393+ } , undefined , ( client ) => {
394+ expect ( client . metadata ( ) ) . to . have . property ( 'grant_types' ) . and . deep . eql ( [ 'implicit' ] ) ;
386395 } ) ;
387- rejects ( this . title , [ 'authorization_code' ] , undefined , {
388- // misses implicit
389- response_types : [ 'token' ] ,
396+ allows ( this . title , [ 'authorization_code' , 'implicit' ] , {
397+ // misses token or id_token in response_types
398+ response_types : [ 'code' ] ,
399+ } , undefined , ( client ) => {
400+ expect ( client . metadata ( ) ) . to . have . property ( 'grant_types' ) . and . deep . eql ( [ 'authorization_code' ] ) ;
390401 } ) ;
391402 } ) ;
392403
@@ -679,7 +690,9 @@ describe('Client metadata validation', () => {
679690 ) ;
680691
681692 rejects ( this . title , [ 123 ] , / m u s t o n l y c o n t a i n s t r i n g s $ / ) ;
682- rejects ( this . title , [ ] , / m u s t c o n t a i n m e m b e r s $ / ) ;
693+ allows ( this . title , [ ] , undefined , undefined , ( client ) => {
694+ expect ( client . metadata ( ) ) . to . have . property ( 'grant_types' ) . and . deep . eql ( [ ] ) ;
695+ } ) ;
683696 rejects ( this . title , [ 'not-a-type' ] ) ;
684697 rejects ( this . title , [ 'not-a-type' , 'none' ] ) ;
685698 } ) ;
0 commit comments