@@ -1270,6 +1270,43 @@ describe('Bell', () => {
12701270 expect ( res . headers . location ) . to . contain ( mock . uri + '/auth?special=true&runtime=5&client_id=test&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Flogin&state=' ) ;
12711271 } ) ;
12721272
1273+ it ( 'authenticates an endpoint token provider parameters' , async ( flags ) => {
1274+
1275+ const mock = await Mock . v2 ( flags ) ;
1276+ const server = Hapi . server ( { host : 'localhost' , port : 8080 } ) ;
1277+ await server . register ( Bell ) ;
1278+
1279+ server . auth . strategy ( 'custom' , 'bell' , {
1280+ password : 'cookie_encryption_password_secure' ,
1281+ isSecure : false ,
1282+ clientId : 'endpoint' ,
1283+ clientSecret : 'secret' ,
1284+ provider : mock . provider ,
1285+ tokenParams : { endpoint : 'https://test.com' }
1286+ } ) ;
1287+
1288+ server . route ( {
1289+ method : '*' ,
1290+ path : '/login' ,
1291+ options : {
1292+ auth : 'custom' ,
1293+ handler : function ( request , h ) {
1294+
1295+ return request . auth . artifacts ;
1296+ }
1297+ }
1298+ } ) ;
1299+
1300+ const res1 = await server . inject ( '/login' ) ;
1301+ const cookie = res1 . headers [ 'set-cookie' ] [ 0 ] . split ( ';' ) [ 0 ] + ';' ;
1302+
1303+ const res2 = await mock . server . inject ( res1 . headers . location ) ;
1304+
1305+ const res3 = await server . inject ( { url : res2 . headers . location , headers : { cookie } } ) ;
1306+ expect ( res3 . statusCode ) . to . equal ( 200 ) ;
1307+ expect ( res3 . result ) . to . include ( { endpoint : 'https://test.com' } ) ;
1308+ } ) ;
1309+
12731310 it ( 'authenticates an endpoint via oauth with plain PKCE' , async ( flags ) => {
12741311
12751312 const mock = await Mock . v2 ( flags ) ;
0 commit comments