diff --git a/IdentityCore/src/MSIDBrokerConstants.h b/IdentityCore/src/MSIDBrokerConstants.h index 65cbf4cf7..203c7e19d 100644 --- a/IdentityCore/src/MSIDBrokerConstants.h +++ b/IdentityCore/src/MSIDBrokerConstants.h @@ -74,6 +74,7 @@ extern NSString * _Nonnull const MSID_ADAL_BROKER_MESSAGE_VERSION; extern NSString * _Nonnull const MSID_MSAL_BROKER_MESSAGE_VERSION; extern NSString * _Nonnull const MSID_BROKER_SDK_CAPABILITIES_KEY; extern NSString * _Nonnull const MSID_BROKER_SDK_SSO_EXTENSION_CAPABILITY; +extern NSString * _Nonnull const MSID_BROKER_SDK_BROKER_XPC_CAPABILITY; extern NSString * _Nonnull const MSID_BROKER_SSO_URL; extern NSString * _Nonnull const MSID_BROKER_ACCOUNT_IDENTIFIER; extern NSString * _Nonnull const MSID_BROKER_TYPES_OF_HEADER; diff --git a/IdentityCore/src/MSIDBrokerConstants.m b/IdentityCore/src/MSIDBrokerConstants.m index f6b37312f..5c3b48567 100644 --- a/IdentityCore/src/MSIDBrokerConstants.m +++ b/IdentityCore/src/MSIDBrokerConstants.m @@ -71,6 +71,7 @@ NSString *const MSID_MSAL_BROKER_MESSAGE_VERSION = @"3"; NSString *const MSID_BROKER_SDK_CAPABILITIES_KEY = @"sdk_broker_capabilities"; NSString *const MSID_BROKER_SDK_SSO_EXTENSION_CAPABILITY = @"sso_extension"; +NSString *const MSID_BROKER_SDK_BROKER_XPC_CAPABILITY = @"broker_xpc"; NSString *const MSID_BROKER_SSO_URL = @"sso_url"; NSString *const MSID_BROKER_ACCOUNT_IDENTIFIER = @"account_identifier"; NSString *const MSID_BROKER_TYPES_OF_HEADER = @"types_of_header"; diff --git a/IdentityCore/src/MSIDError.h b/IdentityCore/src/MSIDError.h index 22d9b87e9..b77d8df3f 100644 --- a/IdentityCore/src/MSIDError.h +++ b/IdentityCore/src/MSIDError.h @@ -26,6 +26,7 @@ extern NSString * _Nonnull MSIDErrorDescriptionKey; extern NSString * _Nonnull MSIDOAuthErrorKey; extern NSString * _Nonnull MSIDOAuthSubErrorKey; +extern NSString * _Nonnull MSIDOAuthSubErrorDescriptionKey; extern NSString * _Nonnull MSIDCorrelationIdKey; extern NSString * _Nonnull MSIDHTTPHeadersKey; extern NSString * _Nonnull MSIDHTTPResponseCodeKey; diff --git a/IdentityCore/src/MSIDError.m b/IdentityCore/src/MSIDError.m index 757c7b177..5de01abe0 100644 --- a/IdentityCore/src/MSIDError.m +++ b/IdentityCore/src/MSIDError.m @@ -26,6 +26,7 @@ NSString *MSIDErrorDescriptionKey = @"MSIDErrorDescriptionKey"; NSString *MSIDOAuthErrorKey = @"MSIDOAuthErrorKey"; NSString *MSIDOAuthSubErrorKey = @"MSIDOAuthSubErrorKey"; +NSString *MSIDOAuthSubErrorDescriptionKey = @"MSIDOAuthSubErrorDescriptionKey"; NSString *MSIDCorrelationIdKey = @"MSIDCorrelationIdKey"; NSString *MSIDHTTPHeadersKey = @"MSIDHTTPHeadersKey"; NSString *MSIDHTTPResponseCodeKey = @"MSIDHTTPResponseCodeKey"; diff --git a/IdentityCore/src/broker_operation/request/MSIDBaseBrokerOperationRequest.h b/IdentityCore/src/broker_operation/request/MSIDBaseBrokerOperationRequest.h index acddf9c83..eb61ee5c5 100644 --- a/IdentityCore/src/broker_operation/request/MSIDBaseBrokerOperationRequest.h +++ b/IdentityCore/src/broker_operation/request/MSIDBaseBrokerOperationRequest.h @@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, class, readonly) NSString *operation; @property (nonatomic) NSUUID *correlationId; +@property (nonatomic) NSInteger requestType; - (nullable NSString *)logInfo; diff --git a/IdentityCore/src/broker_operation/request/token_request/MSIDBrokerOperationTokenRequest.h b/IdentityCore/src/broker_operation/request/token_request/MSIDBrokerOperationTokenRequest.h index adaf19afb..d7c0bd84d 100644 --- a/IdentityCore/src/broker_operation/request/token_request/MSIDBrokerOperationTokenRequest.h +++ b/IdentityCore/src/broker_operation/request/token_request/MSIDBrokerOperationTokenRequest.h @@ -43,6 +43,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, nullable) MSIDClaimsRequest *claimsRequest; @property (nonatomic) NSDate *requestSentDate; @property (nonatomic) NSString *nonce; +@property (nonatomic) NSString *webPageUri; @property (nonatomic, nullable) NSString *accountHomeTenantId; @property (nonatomic, nullable) NSString *clientSku; @property (nonatomic) BOOL skipValidateResultAccount; diff --git a/IdentityCore/src/broker_operation/request/token_request/MSIDBrokerOperationTokenRequest.m b/IdentityCore/src/broker_operation/request/token_request/MSIDBrokerOperationTokenRequest.m index cca25f497..df67d1b18 100644 --- a/IdentityCore/src/broker_operation/request/token_request/MSIDBrokerOperationTokenRequest.m +++ b/IdentityCore/src/broker_operation/request/token_request/MSIDBrokerOperationTokenRequest.m @@ -61,6 +61,7 @@ + (BOOL)fillRequest:(MSIDBrokerOperationTokenRequest *)request request.claimsRequest = parameters.claimsRequest; request.requestSentDate = requestSentDate; request.nonce = parameters.nonce; + request.webPageUri = parameters.webPageUri; request.clientSku = parameters.clientSku; request.skipValidateResultAccount = parameters.skipValidateResultAccount; request.forceRefresh = parameters.forceRefresh; @@ -79,6 +80,8 @@ - (instancetype)initWithJSONDictionary:(NSDictionary *)json error:(NSError *__au _configuration = [[MSIDConfiguration alloc] initWithJSONDictionary:json error:error]; if (!_configuration) return nil; + _webPageUri = [json msidStringObjectForKey:@"web_page_uri"]; + _providerType = MSIDProviderTypeFromString([json msidStringObjectForKey:MSID_PROVIDER_TYPE_JSON_KEY]); _oidcScope = [json msidStringObjectForKey:MSID_BROKER_EXTRA_OIDC_SCOPES_KEY]; @@ -135,6 +138,7 @@ - (NSDictionary *)jsonDictionary } [json addEntriesFromDictionary:configurationJson]; + json[@"web_page_uri"] = self.webPageUri; json[MSID_PROVIDER_TYPE_JSON_KEY] = MSIDProviderTypeToString(self.providerType); json[MSID_BROKER_EXTRA_OIDC_SCOPES_KEY] = self.oidcScope; json[MSID_BROKER_EXTRA_QUERY_PARAM_KEY] = [self.extraQueryParameters msidWWWFormURLEncode]; diff --git a/IdentityCore/src/parameters/MSIDRequestParameters.h b/IdentityCore/src/parameters/MSIDRequestParameters.h index 5eb29a1f6..5e4ef39f4 100644 --- a/IdentityCore/src/parameters/MSIDRequestParameters.h +++ b/IdentityCore/src/parameters/MSIDRequestParameters.h @@ -48,6 +48,7 @@ @property (nonatomic) MSIDAuthority *providedAuthority; @property (nonatomic) MSIDAuthority *cloudAuthority; @property (nonatomic) NSString *redirectUri; +@property (nonatomic) NSString *webPageUri; @property (nonatomic) NSString *clientId; @property (nonatomic) NSString *target; @property (nonatomic) NSString *oidcScope; diff --git a/IdentityCore/src/requests/broker/MSIDSSOExtensionGetAccountsRequest.m b/IdentityCore/src/requests/broker/MSIDSSOExtensionGetAccountsRequest.m index 8a67fed43..07f573e2d 100644 --- a/IdentityCore/src/requests/broker/MSIDSSOExtensionGetAccountsRequest.m +++ b/IdentityCore/src/requests/broker/MSIDSSOExtensionGetAccountsRequest.m @@ -148,9 +148,9 @@ - (void)executeRequestWithCompletion:(nonnull MSIDGetAccountsRequestCompletionBl self.authorizationController.delegate = self.extensionDelegate; self.requestSentDate = [NSDate date]; - [self.authorizationController msidPerformRequests]; - + self.requestCompletionBlock = completionBlock; + [self.authorizationController msidPerformRequests]; } #pragma mark - AuthenticationServices diff --git a/IdentityCore/src/requests/broker/MSIDSSOExtensionGetDeviceInfoRequest.m b/IdentityCore/src/requests/broker/MSIDSSOExtensionGetDeviceInfoRequest.m index 8613e5b57..55e8fe431 100644 --- a/IdentityCore/src/requests/broker/MSIDSSOExtensionGetDeviceInfoRequest.m +++ b/IdentityCore/src/requests/broker/MSIDSSOExtensionGetDeviceInfoRequest.m @@ -131,9 +131,9 @@ - (void)executeRequestWithCompletion:(nonnull MSIDGetDeviceInfoRequestCompletion self.authorizationController = [self controllerWithRequest:ssoRequest]; self.authorizationController.delegate = self.extensionDelegate; self.requestSentDate = [NSDate date]; - [self.authorizationController msidPerformRequests]; - + self.requestCompletionBlock = completionBlock; + [self.authorizationController msidPerformRequests]; } #pragma mark - AuthenticationServices diff --git a/IdentityCore/src/requests/broker/MSIDSSOExtensionInteractiveTokenRequest.m b/IdentityCore/src/requests/broker/MSIDSSOExtensionInteractiveTokenRequest.m index edab8887b..7851ac3eb 100644 --- a/IdentityCore/src/requests/broker/MSIDSSOExtensionInteractiveTokenRequest.m +++ b/IdentityCore/src/requests/broker/MSIDSSOExtensionInteractiveTokenRequest.m @@ -176,9 +176,9 @@ - (void)executeRequestWithCompletion:(MSIDInteractiveRequestCompletionBlock)comp self.authorizationController = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[ssoRequest]]; self.authorizationController.delegate = self.extensionDelegate; self.authorizationController.presentationContextProvider = self; - [self.authorizationController msidPerformRequests]; - self.requestCompletionBlock = completionBlock; + + [self.authorizationController msidPerformRequests]; }]; } diff --git a/IdentityCore/src/requests/broker/MSIDSSOExtensionSignoutRequest.m b/IdentityCore/src/requests/broker/MSIDSSOExtensionSignoutRequest.m index a827ed9d5..22d8be40f 100644 --- a/IdentityCore/src/requests/broker/MSIDSSOExtensionSignoutRequest.m +++ b/IdentityCore/src/requests/broker/MSIDSSOExtensionSignoutRequest.m @@ -170,9 +170,8 @@ - (void)executeRequestWithCompletion:(nonnull MSIDSignoutRequestCompletionBlock) self.authorizationController = [self controllerWithRequest:ssoRequest]; self.authorizationController.delegate = self.extensionDelegate; self.requestSentDate = [NSDate date]; - [self.authorizationController msidPerformRequests]; - self.requestCompletionBlock = completionBlock; + [self.authorizationController msidPerformRequests]; } #pragma mark - AuthenticationServices diff --git a/IdentityCore/src/requests/broker/MSIDSSOExtensionSilentTokenRequest.m b/IdentityCore/src/requests/broker/MSIDSSOExtensionSilentTokenRequest.m index 04b035504..0f13d743c 100644 --- a/IdentityCore/src/requests/broker/MSIDSSOExtensionSilentTokenRequest.m +++ b/IdentityCore/src/requests/broker/MSIDSSOExtensionSilentTokenRequest.m @@ -223,9 +223,8 @@ - (void)executeRequestImplWithCompletionBlock:(MSIDRequestCompletionBlock _Nonnu self.authorizationController = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[ssoRequest]]; self.authorizationController.delegate = self.extensionDelegate; - [self.authorizationController msidPerformRequests]; - self.requestCompletionBlock = completionBlock; + [self.authorizationController msidPerformRequests]; } - (id)tokenCache diff --git a/IdentityCore/tests/automation/ui_tests_lib/MSIDBaseUITest.m b/IdentityCore/tests/automation/ui_tests_lib/MSIDBaseUITest.m index 0f8ee0189..dbc7cd237 100644 --- a/IdentityCore/tests/automation/ui_tests_lib/MSIDBaseUITest.m +++ b/IdentityCore/tests/automation/ui_tests_lib/MSIDBaseUITest.m @@ -436,7 +436,10 @@ - (NSArray *)loadTestAccountRequest:(MSIDAutomationBaseApiRequest *)accountReque XCTAssertTrue(results.count >= 1); XCTestExpectation *passwordLoadExpecation = [self expectationWithDescription:@"Get password"]; - passwordLoadExpecation.expectedFulfillmentCount = results.count; + if (results && results.count > 0) + { + passwordLoadExpecation.expectedFulfillmentCount = results.count; + } for (MSIDTestAutomationAccount *account in results) { diff --git a/azure_pipelines/msal_submodule_check.yaml b/azure_pipelines/msal_submodule_check.yaml new file mode 100644 index 000000000..c1655d688 --- /dev/null +++ b/azure_pipelines/msal_submodule_check.yaml @@ -0,0 +1,112 @@ +# Pipeline will be triggered for PR & any updates on the PR on all branches +pr: + branches: + include: + - '*' + +# Trigger CI for only main/release branches +trigger: + branches: + include: + - main + - release/* + +resources: + repositories: + - repository: microsoft-authentication-library-for-objc + type: github + endpoint: 'MSAL ObjC Service Connection' + name: AzureAD/microsoft-authentication-library-for-objc + +# Define parallel jobs that run build script for specified targets +jobs: +- job: 'Validate_Pull_Request' + strategy: + maxParallel: 3 + matrix: + IOS_FRAMEWORK: + target: "iosFramework iosTestApp sampleIosApp sampleIosAppSwift" + MAC_FRAMEWORK: + target: "macFramework" + VISION_FRAMEWORK: + target: "visionOSFramework" + displayName: Validate Pull Request + pool: + vmImage: 'macOS-14' + timeOutInMinutes: 30 + + steps: + - script: | + /bin/bash -c "sudo xcode-select -s /Applications/Xcode_15.4.app" + displayName: 'Switch to use Xcode 15.4' + - task: CmdLine@2 + displayName: Installing dependencies + inputs: + script: | + gem install xcpretty slather bundler -N + failOnStderr: true + +# The following is needed to install the visionOS SDK on macos-14 vm image which +# doesn't have visionOS installed by default. +# TODO: Remove when macos-14-arm64 is supported on ADO. + - task: Bash@3 + displayName: download visionOS SDK + inputs: + targetType: 'inline' + script: | + echo $(target) + if [ $(target) == 'visionOSFramework' ]; then + echo "Downloading simulator for visionOS" + sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer + defaults write com.apple.dt.Xcode AllowUnsupportedVisionOSHost -bool YES + defaults write com.apple.CoreSimulator AllowUnsupportedVisionOSHost -bool YES + xcodebuild -downloadPlatform visionOS + else + echo "Not visionOS job, no download needed" + fi + failOnStderr: false + + - checkout: microsoft-authentication-library-for-objc + displayName: 'Checkout MSAL' + clean: true + submodules: true + fetchTags: true + persistCredentials: true + + - checkout: self + clean: true + submodules: false + fetchDepth: 1 + path: 's/microsoft-authentication-library-for-objc/MSAL/IdentityCore' + persistCredentials: false + + - task: Bash@3 + displayName: Run Build script & check for Errors + inputs: + targetType: 'inline' + script: | + cd $(Agent.BuildDirectory)/s/microsoft-authentication-library-for-objc + { output=$(./build.py --target $(target) 2>&1 1>&3-) ;} 3>&1 + final_status=$(<./build/status.txt) + echo "FINAL STATUS = ${final_status}" + echo "POSSIBLE ERRORS: ${output}" + + if [ $final_status != "0" ]; then + echo "Build & Testing Failed! \n ${output}" >&2 + fi + failOnStderr: true + - task: Bash@3 + condition: always() + displayName: Cleanup + inputs: + targetType: 'inline' + script: | + rm -rf $(Agent.BuildDirectory)/s/build/status.txt + - task: PublishTestResults@2 + condition: always() + displayName: Publish Test Report + inputs: + testResultsFormat: 'JUnit' + testResultsFiles: '$(Agent.BuildDirectory)/s/build/reports/*' + failTaskOnFailedTests: true + testRunTitle: 'Test Run - $(target)' diff --git a/changelog.txt b/changelog.txt index 8e3e17bf9..6e9f447a5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +Version 1.7.43 +* Support web_page_uri #1440 +* Save error received from ESTS, and return it to the client on silent broker calls (#1438) +* XPC CommonCore Minor change to support broker XPC changes (#1436) +* Assign completion block before perform request (#1434) + Version 1.7.42 * Support extra query parameters on signout (#1243) * Wrap ASAuthorizationProviderExtensionAuthorizationRequest methods (#1427)