@@ -549,3 +549,55 @@ describe('authorize.background() with PAR enabled', async () => {
549549 expect ( response . state ) . toBeDefined ( ) ;
550550 } ) ;
551551} ) ;
552+
553+ describe ( 'authorize.url() with PAR enabled on non-pi.flow server' , async ( ) => {
554+ beforeEach ( ( ) => {
555+ customStorage . remove ( storageKey ) ;
556+ } ) ;
557+
558+ it ( 'returns slim PAR authorize URL for iframe-based server' , async ( ) => {
559+ server . use (
560+ http . get ( '*/wellknown' , async ( ) =>
561+ HttpResponse . json ( {
562+ issuer : 'https://api.example.com/as/issuer' ,
563+ authorization_endpoint : 'https://api.example.com/as/authorize' ,
564+ token_endpoint : 'https://api.example.com/as/token' ,
565+ userinfo_endpoint : 'https://api.example.com/as/userinfo' ,
566+ introspection_endpoint : 'https://api.example.com/as/introspect' ,
567+ revocation_endpoint : 'https://api.example.com/as/revoke' ,
568+ pushed_authorization_request_endpoint : 'https://api.example.com/as/par' ,
569+ response_types_supported : [ 'code' , 'token' , 'id_token' , 'code id_token' ] ,
570+ response_modes_supported : [ 'query' , 'fragment' , 'form_post' ] ,
571+ } ) ,
572+ ) ,
573+ ) ;
574+
575+ const configWithPar : OidcConfig = {
576+ clientId : '123456789' ,
577+ redirectUri : 'https://example.com/callback.html' ,
578+ scope : 'openid profile' ,
579+ serverConfig : { wellknown : 'https://api.example.com/wellknown' } ,
580+ responseType : 'code' ,
581+ par : true ,
582+ } ;
583+
584+ const oidcClient = await oidc ( { config : configWithPar , storage : customStorageConfig } ) ;
585+
586+ if ( 'error' in oidcClient ) {
587+ throw new Error ( 'Error creating OIDC Client' ) ;
588+ }
589+
590+ const url = await oidcClient . authorize . url ( ) ;
591+
592+ if ( typeof url !== 'string' ) {
593+ expect . fail ( `Expected string URL, got: ${ JSON . stringify ( url ) } ` ) ;
594+ }
595+
596+ const parsed = new URL ( url ) ;
597+ expect ( parsed . searchParams . get ( 'client_id' ) ) . toBe ( '123456789' ) ;
598+ expect ( parsed . searchParams . get ( 'request_uri' ) ) . toBe ( parRequestUri ) ;
599+ expect ( parsed . searchParams . has ( 'scope' ) ) . toBe ( false ) ;
600+ expect ( parsed . searchParams . has ( 'code_challenge' ) ) . toBe ( false ) ;
601+ expect ( parsed . searchParams . has ( 'redirect_uri' ) ) . toBe ( false ) ;
602+ } ) ;
603+ } ) ;
0 commit comments