File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ const tokenResponse = json.object({
9595 refresh_token : json . optional ( json . string )
9696} ) ;
9797
98- const pushedAuthorization = json . object ( { request_uri : json . string } ) ;
98+ const pushedAuthorization = json . object ( { request_uri : json . matching ( / ^ \S + $ / , 'a request URI' ) } ) ;
9999
100100/** Unpadded base64url of `length` random bytes. */
101101function random ( length = RANDOM_BYTES ) : string {
@@ -232,6 +232,8 @@ export class Client {
232232 const reply = await this . #post( this . issuer . metadata . revocation_endpoint , {
233233 token : refreshToken
234234 } ) ;
235+ // A success's body carries nothing and is ignored (RFC 7009 §2.2).
236+ if ( reply . status === 200 ) return ;
235237 Client . #read( 'revocation' , reply , ( value ) => value ) ;
236238 }
237239
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
1717
1818const PAR_URL = `${ ISSUER } /oauth/par` ;
1919const REQUEST_URI = 'urn:ietf:params:oauth:request_uri:pushed' ;
20+ const REVOCATION_URL = ( DOCUMENT as { revocation_endpoint : string } ) . revocation_endpoint ;
2021const ID = vector ( 'tokens' , 'id-valid' ) ;
2122const PUBLIC : ClientConfig = { clientId : 'notes-web' , redirectUri : REDIRECT_URI } ;
2223
@@ -112,6 +113,17 @@ test('a refused request keeps its OAuth error; any other answer is a network err
112113 assert . deepEqual ( await outcome ( ( ) => broken . client . refresh ( 'prt_v1_old' ) ) , {
113114 error : { code : 'network' }
114115 } ) ;
116+ const unpushed = await client ( {
117+ [ PAR_URL ] : ( ) => Response . json ( { request_uri : '' , expires_in : 60 } , { status : 201 } )
118+ } ) ;
119+ await assert . rejects ( unpushed . client . authorize ( ) , { code : 'network' } ) ;
120+ } ) ;
121+
122+ test ( 'a revocation succeeds on HTTP 200, whatever its body' , async ( ) => {
123+ const { client : revoking } = await client ( {
124+ [ REVOCATION_URL ] : ( ) => new Response ( 'revoked' , { status : 200 } )
125+ } ) ;
126+ await revoking . revoke ( 'prt_v1_old' ) ;
115127} ) ;
116128
117129test ( 'a login completes with an ID token validated against the pending login' , async ( ) => {
You can’t perform that action at this time.
0 commit comments