Skip to content

Commit

Permalink
Merge pull request #2198 from AzureAD/release/1.4.0
Browse files Browse the repository at this point in the history
MSAL Release 1.4.0
  • Loading branch information
antonioalwan authored Jun 17, 2024
2 parents d2f81de + d7b521d commit 58e2a7c
Show file tree
Hide file tree
Showing 64 changed files with 579 additions and 571 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.4.0]:
* Add platform sequence param. #2192
* Native auth can now store multiple access tokens related to different resources.

## [1.3.3]
* Update common core submodule.
* Automation improvements.
Expand Down
2 changes: 1 addition & 1 deletion MSAL.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MSAL"
s.version = "1.3.3"
s.version = "1.4.0"
s.summary = "Microsoft Authentication Library (MSAL) for iOS"
s.description = <<-DESC
The MSAL library for iOS gives your app the ability to begin using the Microsoft Cloud by supporting Microsoft Azure Active Directory and Microsoft Accounts in a converged experience using industry standard OAuth2 and OpenID Connect. The library also supports Microsoft Azure B2C for those using our hosted identity management service.
Expand Down
2 changes: 1 addition & 1 deletion MSAL/IdentityCore
Submodule IdentityCore updated 40 files
+18 −0 IdentityCore/IdentityCore.xcodeproj/project.pbxproj
+1 −1 IdentityCore/src/MSIDBrokerConstants.h
+1 −1 IdentityCore/src/MSIDBrokerConstants.m
+10 −0 IdentityCore/src/MSIDConstants.h
+1 −0 IdentityCore/src/MSIDConstants.m
+3 −0 IdentityCore/src/MSIDError.h
+4 −0 IdentityCore/src/MSIDError.m
+1 −0 IdentityCore/src/broker_operation/request/MSIDBrokerOperationRequest.h
+4 −0 IdentityCore/src/broker_operation/request/MSIDBrokerOperationRequest.m
+5 −0 ...re/src/broker_operation/response/browser_native_message_response/MSIDBrowserNativeMessageGetTokenResponse.m
+4 −0 IdentityCore/src/parameters/MSIDRequestParameters.h
+2 −1 IdentityCore/src/parameters/MSIDRequestParameters.m
+2 −0 IdentityCore/src/requests/broker/MSIDBrokerTokenRequest.m
+2 −0 IdentityCore/src/util/NSString+MSIDTelemetryExtensions.h
+48 −0 IdentityCore/src/util/NSString+MSIDTelemetryExtensions.m
+1 −1 IdentityCore/src/webview/response/MSIDJITTroubleshootingResponse.m
+101 −0 IdentityCore/tests/MSIDBrowserNativeMessageGetTokenResponseTests.m
+75 −0 IdentityCore/tests/MSIDBrowserNativeMessageSignOutRequestTests.m
+48 −0 IdentityCore/tests/MSIDBrowserNativeMessageSignOutResponseTests.m
+1 −1 IdentityCore/tests/MSIDJITTroubleshootingResponseTests.m
+57 −0 IdentityCore/tests/MSIDRequestParametersTests.m
+40 −0 IdentityCore/tests/MSIDTelemetryExtensionsTests.m
+1 −0 IdentityCore/tests/automation/ui_tests_lib/MSIDBaseUITest.h
+36 −0 IdentityCore/tests/automation/ui_tests_lib/MSIDBaseUITest.m
+4 −0 IdentityCore/tests/automation/ui_tests_lib/MSIDTestConfigurationProvider.m
+1 −0 IdentityCore/tests/automation/ui_tests_lib/lab_api/MSIDAutomationBaseApiRequest.h
+25 −0 IdentityCore/tests/automation/ui_tests_lib/lab_api/MSIDAutomationBaseApiRequest.m
+6 −1 IdentityCore/tests/automation/ui_tests_lib/lab_api/MSIDAutomationDeleteDeviceAPIRequest.m
+2 −0 IdentityCore/tests/automation/ui_tests_lib/lab_api/MSIDAutomationOperationAPIRequestHandler.h
+20 −1 IdentityCore/tests/automation/ui_tests_lib/lab_api/MSIDAutomationOperationAPIRequestHandler.m
+6 −1 IdentityCore/tests/automation/ui_tests_lib/lab_api/MSIDAutomationResetAPIRequest.m
+5 −0 IdentityCore/tests/automation/ui_tests_lib/lab_api/MSIDAutomationTemporaryAccountRequest.m
+3 −0 IdentityCore/tests/mocks/MSIDAccountMetadataCacheAccessorMock.h
+13 −0 IdentityCore/tests/mocks/MSIDAccountMetadataCacheAccessorMock.m
+52 −9 IdentityCore/tests/util/MSIDTestCacheDataSource.m
+1 −0 IdentityCore/tests/util/MSIDTestURLResponse+Util.h
+30 −0 IdentityCore/tests/util/MSIDTestURLResponse+Util.m
+1 −1 azure_pipelines/verify_msalcpp_per_pr_ios.yml
+1 −1 azure_pipelines/verify_msalcpp_per_pr_mac.yml
+5 −0 changelog.txt
4 changes: 0 additions & 4 deletions MSAL/MSAL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@
287F650C2982F4AD00ED90BD /* MSALNativeAuthResponseSerializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 287F650B2982F4AD00ED90BD /* MSALNativeAuthResponseSerializer.swift */; };
287F65182983F77D00ED90BD /* MSALNativeAuthRequestParametersKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 287F65172983F77D00ED90BD /* MSALNativeAuthRequestParametersKey.swift */; };
287F6524298401AE00ED90BD /* MSALNativeAuthResponseSerializerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 287F6523298401AE00ED90BD /* MSALNativeAuthResponseSerializerTests.swift */; };
2884855C295DAFD400516492 /* MSALNativeAuthTokens.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2884855B295DAFD400516492 /* MSALNativeAuthTokens.swift */; };
289747AC2979487900838C80 /* MSALNativeAuthUrlRequestSerializerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 289747A92979487900838C80 /* MSALNativeAuthUrlRequestSerializerTests.swift */; };
289747B129799C6B00838C80 /* MSALNativeAuthInputValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 289747AF29799A8700838C80 /* MSALNativeAuthInputValidator.swift */; };
289E15592948E601006104D9 /* MSALNativeAuthCacheInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 289E15582948E601006104D9 /* MSALNativeAuthCacheInterface.swift */; };
Expand Down Expand Up @@ -1552,7 +1551,6 @@
287F650B2982F4AD00ED90BD /* MSALNativeAuthResponseSerializer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthResponseSerializer.swift; sourceTree = "<group>"; };
287F65172983F77D00ED90BD /* MSALNativeAuthRequestParametersKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthRequestParametersKey.swift; sourceTree = "<group>"; };
287F6523298401AE00ED90BD /* MSALNativeAuthResponseSerializerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthResponseSerializerTests.swift; sourceTree = "<group>"; };
2884855B295DAFD400516492 /* MSALNativeAuthTokens.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthTokens.swift; sourceTree = "<group>"; };
289747A92979487900838C80 /* MSALNativeAuthUrlRequestSerializerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthUrlRequestSerializerTests.swift; sourceTree = "<group>"; };
289747AF29799A8700838C80 /* MSALNativeAuthInputValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthInputValidator.swift; sourceTree = "<group>"; };
289E15582948E601006104D9 /* MSALNativeAuthCacheInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthCacheInterface.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3952,7 +3950,6 @@
children = (
289E156C2948EB8A006104D9 /* MSALNativeAuthCacheAccessor.swift */,
289E15582948E601006104D9 /* MSALNativeAuthCacheInterface.swift */,
2884855B295DAFD400516492 /* MSALNativeAuthTokens.swift */,
);
path = cache;
sourceTree = "<group>";
Expand Down Expand Up @@ -5746,7 +5743,6 @@
E2C61FE729DED73700F15203 /* MSALNativeAuthSignUpChallengeResponseError.swift in Sources */,
289747B129799C6B00838C80 /* MSALNativeAuthInputValidator.swift in Sources */,
DEE34F7AD170B71C00BC302A /* MSALNativeAuthResetPasswordContinueResponseError.swift in Sources */,
2884855C295DAFD400516492 /* MSALNativeAuthTokens.swift in Sources */,
28E4D9032A30ABA200280921 /* ResendCodeError.swift in Sources */,
E2F6269D2A780DDE00C4A303 /* MSALNativeAuthPublicClientApplication+Internal.swift in Sources */,
DEE34F83D170B71C00BC302A /* MSALNativeAuthResetPasswordSubmitResponseError.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion MSAL/resources/ios/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.3.3</string>
<string>1.4.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion MSAL/resources/mac/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.3.3</string>
<string>1.4.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
Expand Down
1 change: 1 addition & 0 deletions MSAL/src/MSALErrorConverter.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ + (void)initialize
@(MSIDErrorJITTroubleshootingAcquireToken) : @(MSALErrorJITTroubleshootingAcquireToken),
@(MSIDErrorDeviceNotPSSORegistered) : @(MSALErrorDeviceNotPSSORegistered),
@(MSIDErrorPSSOKeyIdMismatch) : @(MSALErrorPSSOKeyIdMismatch),
@(MSIDErrorJITErrorHandlingConfigNotFound) : @(MSALErrorJITErrorHandlingConfigNotFound),

// Oauth2 errors
@(MSIDErrorServerOauth) : @(MSALInternalErrorAuthorizationFailed),
Expand Down
17 changes: 15 additions & 2 deletions MSAL/src/MSALPublicClientApplication.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
#import "MSIDAssymetricKeyLookupAttributes.h"
#import "MSIDRequestTelemetryConstants.h"
#import "MSALWipeCacheForAllAccountsConfig.h"
#import "NSString+MSIDTelemetryExtensions.h"
#import "MSIDVersion.h"

@interface MSALPublicClientApplication()
{
Expand Down Expand Up @@ -211,7 +213,7 @@ - (instancetype)initWithConfiguration:(MSALPublicClientApplicationConfig *)confi
bypassRedirectValidation:config.bypassRedirectURIValidation
error:&msidError];

if (!msalRedirectUri)
if (!msalRedirectUri && !config.bypassRedirectURIValidation)
{
if (error) *error = [MSALErrorConverter msalErrorFromMsidError:msidError];
return nil;
Expand Down Expand Up @@ -863,6 +865,10 @@ - (void)acquireTokenSilentWithParameters:(MSALSilentTokenParameters *)parameters
NSMutableDictionary *extraURLQueryParameters = [self.internalConfig.extraQueryParameters.extraURLQueryParameters mutableCopy];
[extraURLQueryParameters addEntriesFromDictionary:parameters.extraQueryParameters];
msidParams.extraURLQueryParameters = extraURLQueryParameters;

msidParams.platformSequence = [NSString msidUpdatePlatformSequenceParamWithSrcName:[MSIDVersion platformName]
srcVersion:[MSIDVersion sdkVersion]
sequence:nil];

msidParams.tokenExpirationBuffer = self.internalConfig.tokenExpirationBuffer;
msidParams.claimsRequest = parameters.claimsRequest.msidClaimsRequest;
Expand All @@ -879,6 +885,7 @@ - (void)acquireTokenSilentWithParameters:(MSALSilentTokenParameters *)parameters
// Nested auth protocol
msidParams.nestedAuthBrokerClientId = self.internalConfig.nestedAuthBrokerClientId;
msidParams.nestedAuthBrokerRedirectUri = self.internalConfig.nestedAuthBrokerRedirectUri;
msidParams.bypassRedirectURIValidation = self.internalConfig.bypassRedirectURIValidation;

MSID_LOG_WITH_CTX_PII(MSIDLogLevelInfo, msidParams,
@"-[MSALPublicClientApplication acquireTokenSilentForScopes:%@\n"
Expand Down Expand Up @@ -1200,6 +1207,10 @@ - (void)acquireTokenWithParameters:(MSALInteractiveTokenParameters *)parameters
[extraURLQueryParameters addEntriesFromDictionary:parameters.extraQueryParameters];
msidParams.extraURLQueryParameters = extraURLQueryParameters;

msidParams.platformSequence = [NSString msidUpdatePlatformSequenceParamWithSrcName:[MSIDVersion platformName]
srcVersion:[MSIDVersion sdkVersion]
sequence:nil];

msidParams.tokenExpirationBuffer = self.internalConfig.tokenExpirationBuffer;
msidParams.extendedLifetimeEnabled = self.internalConfig.extendedLifetimeEnabled;
msidParams.clientCapabilities = self.internalConfig.clientApplicationCapabilities;
Expand Down Expand Up @@ -1453,7 +1464,9 @@ - (void)signoutWithAccount:(nonnull MSALAccount *)account
msidParams.validateAuthority = [self shouldValidateAuthorityForRequestAuthority:requestAuthority];
msidParams.keychainAccessGroup = self.internalConfig.cacheConfig.keychainSharingGroup;
msidParams.providedAuthority = requestAuthority;

msidParams.platformSequence = [NSString msidUpdatePlatformSequenceParamWithSrcName:[MSIDVersion platformName]
srcVersion:[MSIDVersion sdkVersion]
sequence:nil];
NSError *localError;
BOOL localRemovalResult = [self removeAccountImpl:account wipeAccount:signoutParameters.wipeAccount error:&localError];

Expand Down
4 changes: 2 additions & 2 deletions MSAL/src/MSAL_Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
//------------------------------------------------------------------------------

#define MSAL_VER_HIGH 1
#define MSAL_VER_LOW 3
#define MSAL_VER_PATCH 3
#define MSAL_VER_LOW 4
#define MSAL_VER_PATCH 0

#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
Expand Down
1 change: 1 addition & 0 deletions MSAL/src/configuration/MSALPublicClientApplicationConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ - (id)copyWithZone:(NSZone *)zone
item->_verifiedRedirectUri = [_verifiedRedirectUri copyWithZone:zone];
item->_extraQueryParameters = [_extraQueryParameters copyWithZone:zone];
item->_multipleCloudsSupported = _multipleCloudsSupported;
item->_bypassRedirectURIValidation = _bypassRedirectURIValidation;
return item;
}

Expand Down
15 changes: 3 additions & 12 deletions MSAL/src/native_auth/cache/MSALNativeAuthCacheAccessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,17 @@ final class MSALNativeAuthCacheAccessor: MSALNativeAuthCacheInterface {
self.accountMetadataCache = accountMetadataCache
}

func getTokens(
func getIdToken(
account: MSALAccount,
configuration: MSIDConfiguration,
context: MSIDRequestContext) throws -> MSALNativeAuthTokens {
context: MSIDRequestContext) throws -> String? {
let accountConfiguration = try getAccountConfiguration(configuration: configuration, account: account)
let idToken = try tokenCacheAccessor.getIDToken(
forAccount: account.lookupAccountIdentifier,
configuration: accountConfiguration,
idTokenType: MSIDCredentialType.MSIDIDTokenType,
context: context)
let refreshToken = try tokenCacheAccessor.getRefreshToken(
withAccount: account.lookupAccountIdentifier,
familyId: nil,
configuration: accountConfiguration,
context: context)
let accessToken = try tokenCacheAccessor.getAccessToken(
forAccount: account.lookupAccountIdentifier,
configuration: accountConfiguration,
context: context)
return MSALNativeAuthTokens(accessToken: accessToken, refreshToken: refreshToken, rawIdToken: idToken.rawIdToken)
return idToken.rawIdToken
}

func getAllAccounts(configuration: MSIDConfiguration) throws -> [MSALAccount] {
Expand Down
4 changes: 2 additions & 2 deletions MSAL/src/native_auth/cache/MSALNativeAuthCacheInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import Foundation
protocol MSALNativeAuthCacheInterface {
init(tokenCache: MSIDDefaultTokenCacheAccessor, accountMetadataCache: MSIDAccountMetadataCacheAccessor)

func getTokens(
func getIdToken(
account: MSALAccount,
configuration: MSIDConfiguration,
context: MSIDRequestContext) throws -> MSALNativeAuthTokens
context: MSIDRequestContext) throws -> String?

func getAllAccounts(configuration: MSIDConfiguration) throws -> [MSALAccount]

Expand Down
37 changes: 0 additions & 37 deletions MSAL/src/native_auth/cache/MSALNativeAuthTokens.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,21 @@ struct MSALNativeAuthConfiguration {
let clientId: String
let authority: MSIDCIAMAuthority
let challengeTypes: [MSALNativeAuthInternalChallengeType]
let redirectUri: String?
var sliceConfig: MSALSliceConfig?

init(
clientId: String,
authority: MSALCIAMAuthority,
challengeTypes: [MSALNativeAuthInternalChallengeType]) throws {
challengeTypes: [MSALNativeAuthInternalChallengeType],
redirectUri: String?) throws {
self.clientId = clientId
self.authority = try MSIDCIAMAuthority(
url: authority.url,
validateFormat: false,
context: MSALNativeAuthRequestContext()
)
self.challengeTypes = challengeTypes
self.redirectUri = redirectUri
}
}
Loading

0 comments on commit 58e2a7c

Please sign in to comment.