Skip to content

Conversation

@pmathew92
Copy link
Contributor

Changes

This PR adds support for organization support in customTokenExchange in the AuthenticationAPIClient class

Testing

Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. Since this library has unit testing, tests should be added for new functionality and existing tests should complete without errors.

  • This change adds unit test coverage

  • This change adds integration test coverage

  • This change has been tested on the latest version of the platform/language or why not

Checklist

@pmathew92 pmathew92 marked this pull request as ready for review December 9, 2025 10:49
@pmathew92 pmathew92 requested a review from a team as a code owner December 9, 2025 10:49
@pmathew92 pmathew92 requested a review from Copilot December 9, 2025 11:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for an optional organization parameter to the customTokenExchange() method in the AuthenticationAPIClient class. It also introduces a new validation framework with a RequestValidator interface and implements client-side validation for custom token exchange to reject reserved namespaces and validate HTTP/HTTPS URIs.

Key changes:

  • Added optional organization parameter to customTokenExchange() method with default value of null
  • Implemented RequestValidator interface for pre-request validation
  • Created CustomTokenExchangeValidator to validate subject token types (rejects reserved namespaces, validates HTTP/HTTPS URIs)
  • Added validator support to Request, AuthenticationRequest, and their implementations

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt Added organization parameter to customTokenExchange method and integrated validator; expanded wildcard imports to explicit imports
auth0/src/main/java/com/auth0/android/request/internal/validator/CustomTokenExchangeValidator.kt New validator class to validate subject_token_type parameter, rejecting reserved namespaces and validating HTTP/HTTPS URIs
auth0/src/main/java/com/auth0/android/request/RequestValidator.kt New interface defining the validator contract for pre-request validation
auth0/src/main/java/com/auth0/android/request/Request.kt Added addValidator() method with default no-op implementation
auth0/src/main/java/com/auth0/android/request/AuthenticationRequest.kt Added addValidator() method override; removed unused Callback import
auth0/src/main/java/com/auth0/android/request/internal/BaseRequest.kt Implemented validator storage and execution before request execution
auth0/src/main/java/com/auth0/android/request/internal/BaseAuthenticationRequest.kt Implemented addValidator() to delegate to underlying request; expanded wildcard imports
auth0/src/main/java/com/auth0/android/request/SignUpRequest.kt Implemented addValidator() to delegate to authentication request
auth0/src/test/java/com/auth0/android/authentication/AuthenticationAPIClientTest.kt Added comprehensive tests for organization parameter and validator behavior; includes tests for reserved namespaces and invalid URIs; fixed formatting issues
auth0/src/test/java/com/auth0/android/authentication/request/RequestMock.java Added addValidator() no-op implementation to test mock
auth0/src/test/java/com/auth0/android/authentication/request/AuthenticationRequestMock.java Added addValidator() no-op implementation to test mock

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

sanchitmehta94
sanchitmehta94 previously approved these changes Dec 9, 2025
Copy link

@sanchitmehta94 sanchitmehta94 left a comment

Choose a reason for hiding this comment

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

LGTM

@NandanPrabhu
Copy link
Contributor

@claude

@github-actions
Copy link

github-actions bot commented Dec 10, 2025

Claude finished @NandanPrabhu's task —— View job


Code Review Complete

  • Read PR diff
  • Read project architecture documentation
  • Perform code quality review
  • Perform security review
  • Perform performance review
  • Provide inline feedback
  • Update with final assessment

Overall Assessment

❌ This pull request requires changes before it can be merged. While the feature implementation is solid and well-tested, there are several issues that need to be addressed: a critical type safety vulnerability in the validator that could cause runtime crashes, incomplete validation logic for reserved namespace URLs, and minor code style inconsistencies with the existing codebase patterns.


@NandanPrabhu
Copy link
Contributor

@pmathew92 do we still need to add the client side validation? I am assuming it we dont have as confirmed in the CTE channel. profile api alrready does validation for reserve keyword

@pmathew92 pmathew92 merged commit 2f6dc87 into main Dec 10, 2025
6 checks passed
@pmathew92 pmathew92 deleted the cte_org branch December 10, 2025 17:33
@pmathew92 pmathew92 mentioned this pull request Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants