@@ -100,6 +100,51 @@ describe('FAPI 2.0 Final behaviours', () => {
100100 } ) ;
101101 } ) ;
102102
103+ context ( 'allowOmittingSingleRegisteredRedirectUri' , ( ) => {
104+ before ( function ( ) {
105+ this . orig = i ( this . provider ) . configuration . allowOmittingSingleRegisteredRedirectUri ;
106+ i ( this . provider ) . configuration . allowOmittingSingleRegisteredRedirectUri = true ;
107+ } ) ;
108+ after ( function ( ) {
109+ i ( this . provider ) . configuration . allowOmittingSingleRegisteredRedirectUri = this . orig ;
110+ } ) ;
111+ before ( function ( ) { return this . login ( ) ; } ) ;
112+ after ( function ( ) { return this . logout ( ) ; } ) ;
113+
114+ it ( 'is ignored when FAPI 2.0 is used' , async function ( ) {
115+ const emitSpy = sinon . spy ( ) ;
116+ const renderSpy = sinon . spy ( i ( this . provider ) . configuration , 'renderError' ) ;
117+ this . provider . once ( 'authorization.error' , emitSpy ) ;
118+
119+ const auth = new this . AuthorizationRequest ( {
120+ scope : 'openid' ,
121+ client_id : 'client' ,
122+ response_type : 'code' ,
123+ code_challenge_method : undefined ,
124+ code_challenge : undefined ,
125+ redirect_uri : undefined ,
126+ } ) ;
127+
128+ return this . wrap ( {
129+ agent : this . agent ,
130+ route : '/auth' ,
131+ verb : 'get' ,
132+ auth,
133+ } )
134+ . expect ( ( ) => {
135+ renderSpy . restore ( ) ;
136+ } )
137+ . expect ( 400 )
138+ . expect ( ( ) => {
139+ expect ( emitSpy . calledOnce ) . to . be . true ;
140+ expect ( renderSpy . calledOnce ) . to . be . true ;
141+ const renderArgs = renderSpy . args [ 0 ] ;
142+ expect ( renderArgs [ 1 ] ) . to . have . property ( 'error' , 'invalid_request' ) ;
143+ expect ( renderArgs [ 1 ] ) . to . have . property ( 'error_description' , "missing required parameter 'redirect_uri'" ) ;
144+ } ) ;
145+ } ) ;
146+ } ) ;
147+
103148 describe ( 'Request Object' , ( ) => {
104149 beforeEach ( function ( ) { return this . login ( ) ; } ) ;
105150 afterEach ( function ( ) { return this . logout ( ) ; } ) ;
0 commit comments