@@ -616,23 +616,23 @@ describe('AuthorizationCodeGrantType integration', () => {
616616
617617 describe ( 'with PKCE' , function ( ) {
618618 it ( 'should throw an error if the `code_verifier` is invalid with S256 code challenge method' , ( ) => {
619- var codeVerifier = stringUtil . base64URLEncode ( crypto . randomBytes ( 32 ) ) ;
620- var authorizationCode = {
619+ const codeVerifier = stringUtil . base64URLEncode ( crypto . randomBytes ( 32 ) ) ;
620+ const authorizationCode = {
621621 authorizationCode : 12345 ,
622622 client : { id : 'foobar' } ,
623623 expiresAt : new Date ( new Date ( ) . getTime ( ) * 2 ) ,
624624 user : { } ,
625625 codeChallengeMethod : 'S256' ,
626- codeChallenge : stringUtil . base64URLEncode ( crypto . createHash ( 'sha256' ) . update ( codeVerifier ) . digest ( ) )
626+ codeChallenge : stringUtil . base64URLEncode ( crypto . createHash ( 'sha256' ) . update ( codeVerifier ) . digest ( ) ) ,
627627 } ;
628- var client : any = { id : 'foobar' , isPublic : true } ;
629- var model = {
630- getAuthorizationCode : function ( ) { return authorizationCode ; } ,
631- revokeAuthorizationCode : function ( ) { } ,
632- saveToken : function ( ) { }
628+ const client : any = { id : 'foobar' , isPublic : true } ;
629+ const model = {
630+ getAuthorizationCode ( ) { return authorizationCode ; } ,
631+ revokeAuthorizationCode ( ) { } ,
632+ saveToken ( ) { } ,
633633 } ;
634- var grantType = new AuthorizationCodeGrantType ( { accessTokenLifetime : 123 , model : model } ) ;
635- var request = new Request ( { body : { code : 12345 , code_verifier : 'foo' } , headers : { } , method : 'POST' , query : { } } ) ;
634+ const grantType = new AuthorizationCodeGrantType ( { accessTokenLifetime : 123 , model } ) ;
635+ const request = new Request ( { body : { code : 12345 , code_verifier : 'foo' } , headers : { } , method : 'POST' , query : { } } ) ;
636636
637637 return grantType . getAuthorizationCode ( request , client )
638638 . then ( ( ) => {
@@ -645,23 +645,23 @@ describe('AuthorizationCodeGrantType integration', () => {
645645 } ) ;
646646
647647 it ( 'should throw an error if the `code_verifier` is invalid with plain code challenge method' , ( ) => {
648- var codeVerifier = stringUtil . base64URLEncode ( crypto . randomBytes ( 32 ) ) ;
649- var authorizationCode = {
648+ const codeVerifier = stringUtil . base64URLEncode ( crypto . randomBytes ( 32 ) ) ;
649+ const authorizationCode = {
650650 authorizationCode : 12345 ,
651651 client : { id : 'foobar' } ,
652652 expiresAt : new Date ( new Date ( ) . getTime ( ) * 2 ) ,
653653 user : { } ,
654654 codeChallengeMethod : 'plain' ,
655- codeChallenge : codeVerifier
655+ codeChallenge : codeVerifier ,
656656 } ;
657- var client : any = { id : 'foobar' , isPublic : true } ;
658- var model = {
659- getAuthorizationCode : function ( ) { return authorizationCode ; } ,
660- revokeAuthorizationCode : function ( ) { } ,
661- saveToken : function ( ) { }
657+ const client : any = { id : 'foobar' , isPublic : true } ;
658+ const model = {
659+ getAuthorizationCode ( ) { return authorizationCode ; } ,
660+ revokeAuthorizationCode ( ) { } ,
661+ saveToken ( ) { } ,
662662 } ;
663- var grantType = new AuthorizationCodeGrantType ( { accessTokenLifetime : 123 , model : model } ) ;
664- var request = new Request ( { body : { code : 12345 , code_verifier : 'foo' } , headers : { } , method : 'POST' , query : { } } ) ;
663+ const grantType = new AuthorizationCodeGrantType ( { accessTokenLifetime : 123 , model } ) ;
664+ const request = new Request ( { body : { code : 12345 , code_verifier : 'foo' } , headers : { } , method : 'POST' , query : { } } ) ;
665665
666666 return grantType . getAuthorizationCode ( request , client )
667667 . then ( ( ) => {
@@ -674,23 +674,23 @@ describe('AuthorizationCodeGrantType integration', () => {
674674 } ) ;
675675
676676 it ( 'should return an auth code when `code_verifier` is valid with S256 code challenge method' , ( ) => {
677- var codeVerifier = stringUtil . base64URLEncode ( crypto . randomBytes ( 32 ) ) ;
678- var authorizationCode = {
677+ const codeVerifier = stringUtil . base64URLEncode ( crypto . randomBytes ( 32 ) ) ;
678+ const authorizationCode = {
679679 authorizationCode : 12345 ,
680680 client : { id : 'foobar' , isPublic : true } ,
681681 expiresAt : new Date ( new Date ( ) . getTime ( ) * 2 ) ,
682682 user : { } ,
683683 codeChallengeMethod : 'S256' ,
684- codeChallenge : stringUtil . base64URLEncode ( crypto . createHash ( 'sha256' ) . update ( codeVerifier ) . digest ( ) )
684+ codeChallenge : stringUtil . base64URLEncode ( crypto . createHash ( 'sha256' ) . update ( codeVerifier ) . digest ( ) ) ,
685685 } ;
686- var client : any = { id : 'foobar' , isPublic : true } ;
687- var model = {
688- getAuthorizationCode : function ( ) { return authorizationCode ; } ,
689- revokeAuthorizationCode : function ( ) { } ,
690- saveToken : function ( ) { }
686+ const client : any = { id : 'foobar' , isPublic : true } ;
687+ const model = {
688+ getAuthorizationCode ( ) { return authorizationCode ; } ,
689+ revokeAuthorizationCode ( ) { } ,
690+ saveToken ( ) { } ,
691691 } ;
692- var grantType = new AuthorizationCodeGrantType ( { accessTokenLifetime : 123 , model : model } ) ;
693- var request = new Request ( { body : { code : 12345 , code_verifier : codeVerifier } , headers : { } , method : 'POST' , query : { } } ) ;
692+ const grantType = new AuthorizationCodeGrantType ( { accessTokenLifetime : 123 , model } ) ;
693+ const request = new Request ( { body : { code : 12345 , code_verifier : codeVerifier } , headers : { } , method : 'POST' , query : { } } ) ;
694694
695695 return grantType . getAuthorizationCode ( request , client )
696696 . then ( function ( data ) {
@@ -702,23 +702,23 @@ describe('AuthorizationCodeGrantType integration', () => {
702702 } ) ;
703703
704704 it ( 'should return an auth code when `code_verifier` is valid with plain code challenge method' , ( ) => {
705- var codeVerifier = stringUtil . base64URLEncode ( crypto . randomBytes ( 32 ) ) ;
706- var authorizationCode = {
705+ const codeVerifier = stringUtil . base64URLEncode ( crypto . randomBytes ( 32 ) ) ;
706+ const authorizationCode = {
707707 authorizationCode : 12345 ,
708708 client : { id : 'foobar' } ,
709709 expiresAt : new Date ( new Date ( ) . getTime ( ) * 2 ) ,
710710 user : { } ,
711711 codeChallengeMethod : 'plain' ,
712- codeChallenge : codeVerifier
712+ codeChallenge : codeVerifier ,
713713 } ;
714- var client : any = { id : 'foobar' , isPublic : true } ;
715- var model = {
716- getAuthorizationCode : function ( ) { return authorizationCode ; } ,
717- revokeAuthorizationCode : function ( ) { } ,
718- saveToken : function ( ) { }
714+ const client : any = { id : 'foobar' , isPublic : true } ;
715+ const model = {
716+ getAuthorizationCode ( ) { return authorizationCode ; } ,
717+ revokeAuthorizationCode ( ) { } ,
718+ saveToken ( ) { } ,
719719 } ;
720- var grantType = new AuthorizationCodeGrantType ( { accessTokenLifetime : 123 , model : model } ) ;
721- var request = new Request ( { body : { code : 12345 , code_verifier : codeVerifier } , headers : { } , method : 'POST' , query : { } } ) ;
720+ const grantType = new AuthorizationCodeGrantType ( { accessTokenLifetime : 123 , model } ) ;
721+ const request = new Request ( { body : { code : 12345 , code_verifier : codeVerifier } , headers : { } , method : 'POST' , query : { } } ) ;
722722
723723 return grantType . getAuthorizationCode ( request , client )
724724 . then ( function ( data ) {
0 commit comments