Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add test for non-2xx responses from idTokenWithAudience calls #1656

Merged
merged 7 commits into from
Feb 7, 2025

Conversation

lqiu96
Copy link
Contributor

@lqiu96 lqiu96 commented Feb 4, 2025

I believe the issue that was reported in #1027 was actually resolved in #1636.

This PR is to add more tests to ensure that receiving non-2xx status codes back from the idTokenWithAudience are correctly caught.

Fixes #1027

@lqiu96 lqiu96 requested a review from zhumin8 February 4, 2025 22:25
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Feb 4, 2025
@lqiu96 lqiu96 marked this pull request as ready for review February 5, 2025 16:43
@lqiu96 lqiu96 requested review from a team as code owners February 5, 2025 16:43
public void idTokenWithAudience_oauthEndpoint_non2XXStatusCode() throws IOException {
String universeDomain = "test.com";
MockTokenServerTransportFactory transportFactory = new MockTokenServerTransportFactory();
transportFactory.transport.setError(new IOException("404 Not Found"));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TokenServerTransportFactory sets an error response with setError(IOException). This could be refactored in the future to be similar to below .addStatusCodeAndMessage(HttpStatusCodes.STATUS_CODE_NOT_FOUND, "Not Found");.

Copy link

sonarqubecloud bot commented Feb 6, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@lqiu96 lqiu96 merged commit ee98666 into main Feb 7, 2025
17 of 18 checks passed
@lqiu96 lqiu96 deleted the fix-parsing-token branch February 7, 2025 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IllegalArgumentException when parsing token
3 participants