@Test public void verify() { String codeChallenge = CodeVerifier.generateCodeChallenge(CodeVerifier.CodeChallengeMethod.S256, "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"); assertEquals(codeChallenge, "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"); }
public static String generateCodeChallenge(CodeChallengeMethod codeChallengeMethod, String codeVerifier) { Preconditions.checkNotNull(codeChallengeMethod); Preconditions.checkNotNull(codeVerifier); switch (codeChallengeMethod) { case PLAIN: return codeVerifier; case S256: return s256(codeVerifier); } throw new RuntimeException("Unsupported code challenge method: " + codeChallengeMethod); }
CodeVerifier { public static String generateCodeChallenge(CodeChallengeMethod codeChallengeMethod, String codeVerifier) { Preconditions.checkNotNull(codeChallengeMethod); Preconditions.checkNotNull(codeVerifier); switch (codeChallengeMethod) { case PLAIN: return codeVerifier; case S256: return s256(codeVerifier); } throw new RuntimeException("Unsupported code challenge method: " + codeChallengeMethod); } }
CodeVerifier { public static String generateCodeChallenge(CodeChallengeMethod codeChallengeMethod, String codeVerifier) { Preconditions.checkNotNull(codeChallengeMethod); Preconditions.checkNotNull(codeVerifier); switch (codeChallengeMethod) { case PLAIN: return codeVerifier; case S256: return s256(codeVerifier); } throw new RuntimeException("Unsupported code challenge method: " + codeChallengeMethod); } CodeVerifier();  CodeVerifier(CodeChallengeMethod transformationType); }
CodeVerifier { public static String generateCodeChallenge(CodeChallengeMethod codeChallengeMethod, String codeVerifier) { Preconditions.checkNotNull(codeChallengeMethod); Preconditions.checkNotNull(codeVerifier); switch (codeChallengeMethod) { case PLAIN: return codeVerifier; case S256: return s256(codeVerifier); } throw new RuntimeException("Unsupported code challenge method: " + codeChallengeMethod); } CodeVerifier();  CodeVerifier(CodeChallengeMethod transformationType); static String generateCodeChallenge(CodeChallengeMethod codeChallengeMethod, String codeVerifier); static boolean matched(String codeChallenge, String codeChallengeMethod, String codeVerifier); static boolean matched(String codeChallenge, CodeChallengeMethod codeChallengeMethod, String codeVerifier); static String s256(String codeVerifier); static String base64UrlEncode(byte[] input); static String generateCodeVerifier(); static boolean isCodeVerifierValid(String codeVerifier); String getCodeChallenge(); String getCodeVerifier(); CodeChallengeMethod getTransformationType(); @Override String toString(); }
CodeVerifier { public static String generateCodeChallenge(CodeChallengeMethod codeChallengeMethod, String codeVerifier) { Preconditions.checkNotNull(codeChallengeMethod); Preconditions.checkNotNull(codeVerifier); switch (codeChallengeMethod) { case PLAIN: return codeVerifier; case S256: return s256(codeVerifier); } throw new RuntimeException("Unsupported code challenge method: " + codeChallengeMethod); } CodeVerifier();  CodeVerifier(CodeChallengeMethod transformationType); static String generateCodeChallenge(CodeChallengeMethod codeChallengeMethod, String codeVerifier); static boolean matched(String codeChallenge, String codeChallengeMethod, String codeVerifier); static boolean matched(String codeChallenge, CodeChallengeMethod codeChallengeMethod, String codeVerifier); static String s256(String codeVerifier); static String base64UrlEncode(byte[] input); static String generateCodeVerifier(); static boolean isCodeVerifierValid(String codeVerifier); String getCodeChallenge(); String getCodeVerifier(); CodeChallengeMethod getTransformationType(); @Override String toString();  }