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

Use single FRT #1470

Open
wants to merge 23 commits into
base: dev
Choose a base branch
from
Open

Use single FRT #1470

wants to merge 23 commits into from

Conversation

juan-arias
Copy link
Member

Proposed changes

Update the use of family refresh tokens, and instead use a single family refresh token.

Type of change

  • Feature work
  • Bug fix
  • Documentation
  • Engineering change
  • Test
  • Logging/Telemetry

Risk

  • High – Errors could cause MAJOR regression of many scenarios. (Example: new large features or high level infrastructure changes)
  • Medium – Errors could cause regression of 1 or more scenarios. (Example: somewhat complex bug fixes, small new features)
  • Small – No issues are expected. (Example: Very small bug fixes, string changes, or configuration settings changes)

Additional information

@juan-arias juan-arias marked this pull request as ready for review March 20, 2025 21:20
@juan-arias juan-arias requested a review from a team as a code owner March 20, 2025 21:20
MSIDIsFRTEnabledStatusNotEnabled = 0,

// FRT is enabled
MSIDIsFRTEnabledStatusActive,
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Is there a difference between enabled and active? If not, can we use the same (enable vs disable) or active/not active

Copy link
Member Author

Choose a reason for hiding this comment

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

No difference, updated to enable/disable


// Check if FRT is enabled by feature flight
MSIDFlightManager *flightManager = [MSIDFlightManager sharedInstance];
BOOL flagEnableFRT = [flightManager boolForKey:@"enable_client_sfrt_by_tenant_id"]; // TODO: Replace this by the constant from the other branch, and remove the hardcoded YES
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: do you still need TODO here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I will replace this when the other PR (#1489) is merged.

@@ -132,6 +134,77 @@ - (void)acquireTokenWithCodeResult:(MSIDAuthorizationCodeResult *) __unused auth
#endif
}

- (void)updateCustomHeadersForFRTSupportIfNeeded
{
#if !EXCLUDE_FROM_MSALCPP && !AD_BROKER
Copy link
Contributor

Choose a reason for hiding this comment

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

For my learning: Any reason this is not included in OneAuth/MSAL?

Copy link
Member Author

Choose a reason for hiding this comment

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

OneAuth already do this on their side, but we didn't.


// Check if FRT is enabled by feature flight
MSIDFlightManager *flightManager = [MSIDFlightManager sharedInstance];
BOOL flagEnableFRT = [flightManager boolForKey:@"enable_client_sfrt_by_tenant_id"];// || YES; // TODO: Replace this by the constant from the other branch, and remove the hardcoded YES
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this TODO still need?

Copy link
Member Author

Choose a reason for hiding this comment

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

With the other PR merged, I have replaced this string with the right constant.

@@ -32,6 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, nullable) NSString *logComponent;
@property (nonatomic, nullable) NSString *telemetryRequestId;
@property (nonatomic, nullable) NSDictionary *appRequestMetadata;
@property (nonatomic, readwrite) BOOL disableFRT;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: readwrite is by default I think, can be removed

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated


@interface MSIDFamilyRefreshToken : MSIDRefreshToken
{

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: if not property, please consider removing the {} block

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated


- (instancetype)initWithRefreshToken:(MSIDRefreshToken *)refreshToken
{
if (refreshToken && [refreshToken isKindOfClass:[MSIDRefreshToken class]])
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Can we do the validation before passing into the init method? And also log the type of the token if type is not expected
  2. Please consider to remove duplicate code. e.g. if this is a subclass, maybe the credentialType is only needed?

@@ -149,6 +151,11 @@ - (void)showWebComponentWithCompletion:(MSIDWebviewAuthCompletionHandler)complet

}

- (void)updateCustomHeadersForFRTSupportIfNeeded
{
Copy link
Contributor

Choose a reason for hiding this comment

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

nit saw this pattern in code base:

    NSAssert(NO, @"Abstract method.");
    return;

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

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.

2 participants