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

Merge dev into release/1.6.0 #2363

Merged
merged 5 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MSAL/MSAL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9009,6 +9009,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
TARGETED_DEVICE_FAMILY = "1,2,7";
XROS_DEPLOYMENT_TARGET = 1.2;
};
name = Debug;
};
Expand All @@ -9024,6 +9025,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
TARGETED_DEVICE_FAMILY = "1,2,7";
XROS_DEPLOYMENT_TARGET = 1.2;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ final class MSALNativeAuthUserAccountEndToEndTests: MSALNativeAuthEndToEndPasswo
XCTAssertEqual(signInDelegateSpy.result?.account.username, username)
}

// Sign in with username and password to get access token and force refresh with existing scopes
func test_signInAndForceRefreshWithExistingScopesSucceeds() async throws {
// Sign in with username and password to get access token and force refresh with access token not linked to client Id
func test_signInAndForceRefreshWithNotConfiguredScopes() async throws {
#if os(macOS)
throw XCTSkip("Bundle id for macOS is not added to the client id, test is not needed on both iOS and macOS")
#endif
Expand All @@ -83,38 +83,6 @@ final class MSALNativeAuthUserAccountEndToEndTests: MSALNativeAuthEndToEndPasswo
XCTAssertNotNil(signInDelegateSpy.result?.idToken)
XCTAssertEqual(signInDelegateSpy.result?.account.username, username)

let previousIdToken = signInDelegateSpy.result?.idToken
let refreshAccessTokenExpectation = expectation(description: "refreshing access token")
let credentialsDelegateSpy = CredentialsDelegateSpy(expectation: refreshAccessTokenExpectation)

signInDelegateSpy.result?.getAccessToken(scopes: ["User.Read"], forceRefresh: true, delegate: credentialsDelegateSpy)

await fulfillment(of: [refreshAccessTokenExpectation])

XCTAssertTrue(credentialsDelegateSpy.onAccessTokenRetrieveCompletedCalled)
XCTAssertNotNil(credentialsDelegateSpy.result?.accessToken)
XCTAssertNotEqual(previousIdToken, signInDelegateSpy.result?.idToken)
XCTAssertEqual(signInDelegateSpy.result?.account.username, username)
}

// Sign in with username and password to get access token and force refresh with different scopes
func test_signInAndForceRefreshWithDifferentScopesFails() async throws {
guard let sut = initialisePublicClientApplication(), let username = retrieveUsernameForSignInUsernameAndPassword(), let password = await retrievePasswordForSignInUsername() else {
XCTFail("Missing information")
return
}

let signInExpectation = expectation(description: "signing in")
let signInDelegateSpy = SignInPasswordStartDelegateSpy(expectation: signInExpectation)

sut.signIn(username: username, password: password, correlationId: correlationId, delegate: signInDelegateSpy)

await fulfillment(of: [signInExpectation])

XCTAssertTrue(signInDelegateSpy.onSignInCompletedCalled)
XCTAssertNotNil(signInDelegateSpy.result?.idToken)
XCTAssertEqual(signInDelegateSpy.result?.account.username, username)

let refreshAccessTokenExpectation = expectation(description: "refreshing access token")
let credentialsDelegateSpy = CredentialsDelegateSpy(expectation: refreshAccessTokenExpectation)

Expand Down
Loading