File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
javatests/com/google/auth/oauth2
java/com/google/auth/oauth2 Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ private class CodeChallenge {
9090
9191 byte [] digest = md .digest ();
9292
93- this .codeChallenge = Base64 .getUrlEncoder ().encodeToString (digest );
93+ this .codeChallenge = Base64 .getUrlEncoder ().encodeToString (digest ). replace ( "=" , "" ) ;
9494 this .codeChallengeMethod = "S256" ;
9595 } catch (NoSuchAlgorithmException e ) {
9696 this .codeChallenge = codeVerifier ;
Original file line number Diff line number Diff line change 3232package com .google .auth .oauth2 ;
3333
3434import static org .junit .Assert .assertEquals ;
35+ import static org .junit .Assert .assertFalse ;
3536
3637import java .security .MessageDigest ;
3738import java .security .NoSuchAlgorithmException ;
@@ -52,10 +53,17 @@ public void testPkceExpected() throws NoSuchAlgorithmException {
5253
5354 byte [] digest = md .digest ();
5455
55- String expectedCodeChallenge = Base64 .getUrlEncoder ().encodeToString (digest );
56+ String expectedCodeChallenge = Base64 .getUrlEncoder ().encodeToString (digest ). replace ( "=" , "" ) ;
5657 String expectedCodeChallengeMethod = "S256" ;
5758
5859 assertEquals (pkce .getCodeChallenge (), expectedCodeChallenge );
5960 assertEquals (pkce .getCodeChallengeMethod (), expectedCodeChallengeMethod );
6061 }
62+
63+ @ Test
64+ public void testNoBase64Padding () throws NoSuchAlgorithmException {
65+ PKCEProvider pkce = new DefaultPKCEProvider ();
66+ assertFalse (pkce .getCodeChallenge ().endsWith ("=" ));
67+ assertFalse (pkce .getCodeChallenge ().contains ("=" ));
68+ }
6169}
You can’t perform that action at this time.
0 commit comments