Skip to content

Add support for Multi-Resource Refresh Token (MRRT)#912

Merged
Widcket merged 47 commits intomasterfrom
feat/mrrt
May 8, 2025
Merged

Add support for Multi-Resource Refresh Token (MRRT)#912
Widcket merged 47 commits intomasterfrom
feat/mrrt

Conversation

@Widcket
Copy link
Contributor

@Widcket Widcket commented Mar 11, 2025

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

This PR moves the Credentials Manager from a single credentials model to a multiple credentials one, supporting:

  • 1 set of app credentials (the existing functionality)
  • N sets of API-specific credentials

To this end, two new public methods were added to the Credentials Manager:

// Plus its combine + async/await wrappers

func apiCredentials(forAudience audience: String,
                    scope: String? = nil,
                    minTTL: Int = 0,
                    parameters: [String: Any] = [:],
                    headers: [String: String] = [:],
                    callback: @escaping (CredentialsManagerResult<APICredentials>) -> Void)
func clear(forAudience audience: String) -> Bool

The Authentication API client's renew(withRefreshToken:scope:) method also gained a new audience argument —that defaults to nil— allowing the exchange of a refresh token for API-specific credentials.

🎯 Testing

A complete test suite is included.

@Widcket Widcket requested a review from a team as a code owner March 11, 2025 00:20

}

context("api credentials") {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are the tests for the async/await wrapper.


}

context("api credentials") {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are the tests for the Combine wrapper. Combine is Apple's framework for functional reactive programming.

parameters: [String: Any],
headers: [String: String],
forceRenewal: Bool = false,
forceRenewal: Bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason to remove the default value from forceRenewal parameter ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it's explicit at the call site.

pmathew92
pmathew92 previously approved these changes Mar 12, 2025
Copy link
Contributor

@pmathew92 pmathew92 left a comment

Choose a reason for hiding this comment

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

LGTM

@Widcket Widcket requested a review from pmathew92 April 15, 2025 20:16
NandanPrabhu
NandanPrabhu previously approved these changes Apr 21, 2025
@Widcket Widcket enabled auto-merge (squash) May 8, 2025 13:28
@Widcket Widcket merged commit 9a73fe6 into master May 8, 2025
10 checks passed
@Widcket Widcket deleted the feat/mrrt branch May 8, 2025 13:32
@Widcket Widcket mentioned this pull request May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants