Skip to content

Commit ffdc650

Browse files
committed
Merge branch 'dev' into jarias/use-single-frt
# Conflicts: # MSAL/IdentityCore
2 parents a42bc75 + de05cbc commit ffdc650

17 files changed

+817
-134
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## TBD
2+
* Support sendable result #2518
3+
* Support DUNA protocol for CBA flow #2508
4+
15
## [1.7.0]
26
* Add support for claims request in native authentication signIn (#2496)
37
* Move native auth public methods to parameter class (#2492)

MSAL/IdentityCore

Submodule IdentityCore updated 86 files

MSAL/MSAL.xcodeproj/project.pbxproj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5811,8 +5811,6 @@
58115811
};
58125812
D61A64321E5A29580086D120 = {
58135813
CreatedOnToolsVersion = 8.2.1;
5814-
DevelopmentTeam = UBF8T346G9;
5815-
ProvisioningStyle = Manual;
58165814
SystemCapabilities = {
58175815
com.apple.Keychain = {
58185816
enabled = 1;
@@ -8783,9 +8781,8 @@
87838781
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "";
87848782
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
87858783
CODE_SIGN_ENTITLEMENTS = "MSAL Test App.entitlements";
8786-
CODE_SIGN_IDENTITY = "iPhone Developer";
8787-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
8788-
CODE_SIGN_STYLE = Manual;
8784+
CODE_SIGN_IDENTITY = "Apple Development";
8785+
CODE_SIGN_STYLE = Automatic;
87898786
DEVELOPMENT_TEAM = UBF8T346G9;
87908787
ENABLE_BITCODE = NO;
87918788
GCC_OPTIMIZATION_LEVEL = 0;
@@ -8797,7 +8794,7 @@
87978794
);
87988795
PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.MSALTestApp;
87998796
PROVISIONING_PROFILE = "";
8800-
PROVISIONING_PROFILE_SPECIFIER = "iOS Team Provisioning Profile";
8797+
PROVISIONING_PROFILE_SPECIFIER = "";
88018798
USER_HEADER_SEARCH_PATHS = (
88028799
"$(inherited)",
88038800
"$IDCORE_PATH/src/**",

MSAL/MSAL.xcodeproj/xcshareddata/xcschemes/MSAL Test App (iOS).xcscheme

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30-
<Testables>
31-
</Testables>
3230
<MacroExpansion>
3331
<BuildableReference
3432
BuildableIdentifier = "primary"
@@ -38,8 +36,8 @@
3836
ReferencedContainer = "container:MSAL.xcodeproj">
3937
</BuildableReference>
4038
</MacroExpansion>
41-
<AdditionalOptions>
42-
</AdditionalOptions>
39+
<Testables>
40+
</Testables>
4341
</TestAction>
4442
<LaunchAction
4543
buildConfiguration = "Debug"
@@ -61,8 +59,6 @@
6159
ReferencedContainer = "container:MSAL.xcodeproj">
6260
</BuildableReference>
6361
</BuildableProductRunnable>
64-
<AdditionalOptions>
65-
</AdditionalOptions>
6662
</LaunchAction>
6763
<ProfileAction
6864
buildConfiguration = "Release"

MSAL/src/MSALPublicClientApplication.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
#import "MSALWebviewParameters.h"
9090
#import "MSIDAccountIdentifier.h"
9191
#if TARGET_OS_IPHONE
92-
#import "MSIDCertAuthHandler+iOS.h"
9392
#import "MSIDBrokerInteractiveController.h"
9493
#import <UIKit/UIKit.h>
9594
#else
@@ -113,6 +112,7 @@
113112
#import "MSALWipeCacheForAllAccountsConfig.h"
114113
#import "NSString+MSIDTelemetryExtensions.h"
115114
#import "MSIDVersion.h"
115+
#import "MSIDCertAuthManager.h"
116116

117117
@interface MSALPublicClientApplication()
118118
{
@@ -142,7 +142,7 @@ + (void)load
142142
MSIDNotifications.webAuthWillSwitchToBrokerAppNotificationName = MSALWebAuthWillSwitchToBrokerApp;
143143
MSIDNotifications.webAuthDidReceiveResponseFromBrokerNotificationName = MSALWebAuthDidReceiveResponseFromBroker;
144144
#if TARGET_OS_IPHONE && !AD_BROKER && !MSID_EXCLUDE_SYSTEMWV
145-
[MSIDCertAuthHandler setUseAuthSession:YES];
145+
MSIDCertAuthManager.sharedInstance.useAuthSession = YES;
146146
#endif
147147
}
148148

@@ -626,8 +626,8 @@ + (BOOL)handleMSALResponse:(NSURL *)response
626626
{
627627
return YES;
628628
}
629-
630-
if ([MSIDCertAuthHandler completeCertAuthChallenge:response])
629+
630+
if ([MSIDCertAuthManager.sharedInstance completeWithCallbackURL:response])
631631
{
632632
return YES;
633633
}

MSAL/src/public/MSALResult.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
MSALResult represents information returned to the application after a successful interactive or silent token acquisition.
3636
It contains information requested by the application (e.g. access_token and id_token), and information that can be used to get a token silently from MSAL (e.g. account).
3737
*/
38+
NS_SWIFT_SENDABLE
3839
@interface MSALResult : NSObject
3940

4041
#pragma mark - Token response

MSAL/test/integration/native_auth/end_to_end/credentials/MSALNativeAuthUserAccountEndToEndTests.swift

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import Foundation
2626
import XCTest
27+
import MSAL
2728

2829
final class MSALNativeAuthUserAccountEndToEndTests: MSALNativeAuthEndToEndPasswordTestCase {
2930

@@ -40,7 +41,10 @@ final class MSALNativeAuthUserAccountEndToEndTests: MSALNativeAuthEndToEndPasswo
4041
let signInExpectation = expectation(description: "signing in")
4142
let signInDelegateSpy = SignInPasswordStartDelegateSpy(expectation: signInExpectation)
4243

43-
sut.signIn(username: username, password: password, correlationId: correlationId, delegate: signInDelegateSpy)
44+
let param = MSALNativeAuthSignInParameters(username: username)
45+
param.password = password
46+
param.correlationId = correlationId
47+
sut.signIn(parameters: param, delegate: signInDelegateSpy)
4448

4549
await fulfillment(of: [signInExpectation])
4650

@@ -52,7 +56,9 @@ final class MSALNativeAuthUserAccountEndToEndTests: MSALNativeAuthEndToEndPasswo
5256
let refreshAccessTokenExpectation = expectation(description: "refreshing access token")
5357
let credentialsDelegateSpy = CredentialsDelegateSpy(expectation: refreshAccessTokenExpectation)
5458

55-
signInDelegateSpy.result?.getAccessToken(forceRefresh: true, delegate: credentialsDelegateSpy)
59+
let tokenParam = MSALNativeAuthGetAccessTokenParameters()
60+
tokenParam.forceRefresh = true
61+
signInDelegateSpy.result?.getAccessToken(parameters: tokenParam, delegate: credentialsDelegateSpy)
5662

5763
await fulfillment(of: [refreshAccessTokenExpectation])
5864

@@ -75,7 +81,10 @@ final class MSALNativeAuthUserAccountEndToEndTests: MSALNativeAuthEndToEndPasswo
7581
let signInExpectation = expectation(description: "signing in")
7682
let signInDelegateSpy = SignInPasswordStartDelegateSpy(expectation: signInExpectation)
7783

78-
sut.signIn(username: username, password: password, correlationId: correlationId, delegate: signInDelegateSpy)
84+
let signInParam = MSALNativeAuthSignInParameters(username: username)
85+
signInParam.password = password
86+
signInParam.correlationId = correlationId
87+
sut.signIn(parameters: signInParam, delegate: signInDelegateSpy)
7988

8089
await fulfillment(of: [signInExpectation])
8190

@@ -86,11 +95,48 @@ final class MSALNativeAuthUserAccountEndToEndTests: MSALNativeAuthEndToEndPasswo
8695
let refreshAccessTokenExpectation = expectation(description: "refreshing access token")
8796
let credentialsDelegateSpy = CredentialsDelegateSpy(expectation: refreshAccessTokenExpectation)
8897

89-
signInDelegateSpy.result?.getAccessToken(scopes: ["Calendar.Read"], forceRefresh: true, delegate: credentialsDelegateSpy)
98+
let tokenParam = MSALNativeAuthGetAccessTokenParameters()
99+
tokenParam.scopes = ["Calendar.Read"]
100+
tokenParam.forceRefresh = true
101+
signInDelegateSpy.result?.getAccessToken(parameters: tokenParam, delegate: credentialsDelegateSpy)
90102

91103
await fulfillment(of: [refreshAccessTokenExpectation])
92104

93105
XCTAssertTrue(credentialsDelegateSpy.onAccessTokenRetrieveErrorCalled)
94106
XCTAssertTrue(credentialsDelegateSpy.error!.errorDescription!.contains("Send an interactive authorization request for this user and resource."))
95107
}
108+
109+
// Sign in with username and password with extra scopes to get access token and validate the scopes
110+
func test_signInWithExtraScopes() async throws {
111+
#if os(macOS)
112+
throw XCTSkip("Bundle id for macOS is not added to the client id, test is not needed on both iOS and macOS")
113+
#endif
114+
guard let sut = initialisePublicClientApplication(), let username = retrieveUsernameForSignInUsernameAndPassword(), let password = await retrievePasswordForSignInUsername() else {
115+
XCTFail("Missing information")
116+
return
117+
}
118+
119+
let signInExpectation = expectation(description: "signing in")
120+
let signInDelegateSpy = SignInPasswordStartDelegateSpy(expectation: signInExpectation)
121+
122+
sut.signIn(username: username, password: password, scopes: ["User.Read"], correlationId: correlationId, delegate: signInDelegateSpy)
123+
124+
await fulfillment(of: [signInExpectation])
125+
126+
XCTAssertTrue(signInDelegateSpy.onSignInCompletedCalled)
127+
XCTAssertNotNil(signInDelegateSpy.result?.idToken)
128+
XCTAssertEqual(signInDelegateSpy.result?.account.username, username)
129+
130+
let getAccessTokenExpectation = expectation(description: "getting access token")
131+
let credentialsDelegateSpy = CredentialsDelegateSpy(expectation: getAccessTokenExpectation)
132+
133+
signInDelegateSpy.result?.getAccessToken(scopes: ["User.Read"], delegate: credentialsDelegateSpy)
134+
135+
await fulfillment(of: [getAccessTokenExpectation])
136+
137+
XCTAssertTrue(credentialsDelegateSpy.onAccessTokenRetrieveCompletedCalled)
138+
XCTAssertNotNil(credentialsDelegateSpy.result?.accessToken)
139+
XCTAssertNotNil(credentialsDelegateSpy.result?.scopes)
140+
XCTAssertTrue(credentialsDelegateSpy.result!.scopes.contains("User.Read"))
141+
}
96142
}

MSAL/test/integration/native_auth/end_to_end/mfa/MSALNativeAuthSignInWithMFAEndToEndTests.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,12 @@ final class MSALNativeAuthSignInWithMFAEndToEndTests: MSALNativeAuthEndToEndPass
323323
}
324324
let signInExpectation = expectation(description: "signing in")
325325
let signInDelegateSpy = SignInPasswordStartDelegateSpy(expectation: signInExpectation)
326+
327+
let param = MSALNativeAuthSignInParameters(username: username)
328+
param.password = password
329+
param.correlationId = correlationId
326330

327-
application.signIn(username: username, password: password, correlationId: correlationId, delegate: signInDelegateSpy)
331+
application.signIn(parameters: param, delegate: signInDelegateSpy)
328332

329333
await fulfillment(of: [signInExpectation])
330334

0 commit comments

Comments
 (0)