Skip to content

Commit ff50227

Browse files
authored
Make public capabilities not optional to make it visible to Objecitve-C (#2657)
* make public capabilities not optional * Add new objc test * update header file
1 parent d0947ea commit ff50227

File tree

5 files changed

+49
-3
lines changed

5 files changed

+49
-3
lines changed

MSAL/MSAL.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@
386386
28F8D29F2D8C6C3A005084FA /* MSALNativeAuthRegisterStrongAuthVerificationRequiredResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28F8D29D2D8C6C37005084FA /* MSALNativeAuthRegisterStrongAuthVerificationRequiredResult.swift */; };
387387
28F8D2A12D8C7A4F005084FA /* RegisterStrongAuthSubmitChallengeError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28F8D2A02D8C7A49005084FA /* RegisterStrongAuthSubmitChallengeError.swift */; };
388388
28F8D2A22D8C7A4F005084FA /* RegisterStrongAuthSubmitChallengeError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28F8D2A02D8C7A49005084FA /* RegisterStrongAuthSubmitChallengeError.swift */; };
389+
28FB1BB62E0AF1F90065B784 /* MSALNativeAuthPublicClientApplicationConfigObjCTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 28FB1BB52E0AF1F90065B784 /* MSALNativeAuthPublicClientApplicationConfigObjCTest.m */; };
390+
28FB1BB72E0AF1F90065B784 /* MSALNativeAuthPublicClientApplicationConfigObjCTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 28FB1BB52E0AF1F90065B784 /* MSALNativeAuthPublicClientApplicationConfigObjCTest.m */; };
389391
28FDC49C2A38BFA900E38BE1 /* SignInAfterSignUpState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28FDC49B2A38BFA900E38BE1 /* SignInAfterSignUpState.swift */; };
390392
28FDC4A62A38C00900E38BE1 /* SignInAfterSignUpDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28FDC4A52A38C00900E38BE1 /* SignInAfterSignUpDelegate.swift */; };
391393
28FDC4A92A38C0D100E38BE1 /* SignInAfterSignUpError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28FDC4A82A38C0D000E38BE1 /* SignInAfterSignUpError.swift */; };
@@ -2183,6 +2185,7 @@
21832185
28F8D2992D8C6612005084FA /* RegisterStrongAuthChallengeError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterStrongAuthChallengeError.swift; sourceTree = "<group>"; };
21842186
28F8D29D2D8C6C37005084FA /* MSALNativeAuthRegisterStrongAuthVerificationRequiredResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthRegisterStrongAuthVerificationRequiredResult.swift; sourceTree = "<group>"; };
21852187
28F8D2A02D8C7A49005084FA /* RegisterStrongAuthSubmitChallengeError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterStrongAuthSubmitChallengeError.swift; sourceTree = "<group>"; };
2188+
28FB1BB52E0AF1F90065B784 /* MSALNativeAuthPublicClientApplicationConfigObjCTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSALNativeAuthPublicClientApplicationConfigObjCTest.m; sourceTree = "<group>"; };
21862189
28FDC49B2A38BFA900E38BE1 /* SignInAfterSignUpState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInAfterSignUpState.swift; sourceTree = "<group>"; };
21872190
28FDC4A52A38C00900E38BE1 /* SignInAfterSignUpDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInAfterSignUpDelegate.swift; sourceTree = "<group>"; };
21882191
28FDC4A82A38C0D000E38BE1 /* SignInAfterSignUpError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInAfterSignUpError.swift; sourceTree = "<group>"; };
@@ -3095,6 +3098,7 @@
30953098
E2CD2E3F29FBE957009F8FFA /* state_machine */,
30963099
287F64F22981A00400ED90BD /* MSALNativeAuthPublicClientApplicationTest.swift */,
30973100
289C1D912DE8D059009EEBEA /* MSALNativeAuthPublicClientApplicationConfigTest.swift */,
3101+
28FB1BB52E0AF1F90065B784 /* MSALNativeAuthPublicClientApplicationConfigObjCTest.m */,
30983102
DE87DE692A39E80B0032BF9E /* MSALNativeAuthUserAccountResultTests.swift */,
30993103
);
31003104
path = public;
@@ -7458,6 +7462,7 @@
74587462
E22952682A1A4FCB00EDD58C /* MSALNativeAuthSignUpResponseValidatorTests.swift in Sources */,
74597463
289E44B92C9D843F00F6B9D7 /* MFARequestChallengeErrorTests.swift in Sources */,
74607464
E286E2DD2A1BAEA800666DD0 /* MSALNativeAuthSignUpControllerTests.swift in Sources */,
7465+
28FB1BB72E0AF1F90065B784 /* MSALNativeAuthPublicClientApplicationConfigObjCTest.m in Sources */,
74617466
B2725EC522BF4865009B454A /* MSALMockExternalAccountHandler.m in Sources */,
74627467
E2C190772B20DF4300095534 /* SignInAfterResetPasswordErrorTests.swift in Sources */,
74637468
9BD2765F2A0E81CE00FBD033 /* ResetPasswordRequiredStateTests.swift in Sources */,
@@ -7758,6 +7763,7 @@
77587763
DE8DC5202C6621F500534E8F /* ResetPasswordStartDelegateDispatcherTests.swift in Sources */,
77597764
DE8DC55C2C66221700534E8F /* MSALNativeAuthResetPasswordStartRequestParametersTest.swift in Sources */,
77607765
28EE651C2C8B0FF500015F90 /* MSALNativeAuthMFAControllerTests.swift in Sources */,
7766+
28FB1BB62E0AF1F90065B784 /* MSALNativeAuthPublicClientApplicationConfigObjCTest.m in Sources */,
77617767
289E44BA2C9D843F00F6B9D7 /* MFARequestChallengeErrorTests.swift in Sources */,
77627768
DE8DC56C2C66221C00534E8F /* MSALNativeLoggingTests.swift in Sources */,
77637769
);

MSAL/src/native_auth/configuration/MSALNativeAuthInternalConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct MSALNativeAuthInternalConfiguration {
7777
private static func getInternalCapabilities(
7878
_ capabilities: MSALNativeAuthCapabilities?
7979
) -> [MSALNativeAuthInternalCapability]? {
80-
guard let capabilities else { return nil }
80+
guard let capabilities, !capabilities.isEmpty else { return nil }
8181
var internalCapabilities: [MSALNativeAuthInternalCapability] = []
8282

8383
if capabilities.contains(.mfaRequired) {

MSAL/src/native_auth/public/configuration/MSALNativeAuthPublicClientApplicationConfig.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public final class MSALNativeAuthPublicClientApplicationConfig: MSALPublicClient
2929
let challengeTypes: MSALNativeAuthChallengeTypes
3030

3131
/** The set of capabilities that this application can support as an ``MSALNativeAuthCapabilities`` optionset */
32-
public var capabilities: MSALNativeAuthCapabilities?
32+
public var capabilities: MSALNativeAuthCapabilities = []
3333

3434
/// Initialize a MSALNativeAuthPublicClientApplicationConfig.
3535
/// - Parameters:

MSAL/src/native_auth/public/state_machine/result/MSALNativeAuthUserAccountResult+Internal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extension MSALNativeAuthUserAccountResult {
5151
challengeTypes: challengeTypes
5252
)
5353
config.bypassRedirectURIValidation = configuration.redirectUri == nil
54-
config.capabilities = capabilities
54+
config.capabilities = capabilities ?? []
5555

5656
guard let silentTokenProvider = try? silentTokenProviderFactory.makeSilentTokenProvider(configuration: config)
5757
else {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// Copyright (c) Microsoft Corporation.
3+
// All rights reserved.
4+
//
5+
// This code is licensed under the MIT License.
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files(the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions :
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
25+
#import <XCTest/XCTest.h>
26+
#import <MSAL/MSAL.h>
27+
28+
@interface MSALNativeAuthPublicClientApplicationConfigObjCTest : XCTestCase
29+
30+
@end
31+
32+
@implementation MSALNativeAuthPublicClientApplicationConfigObjCTest
33+
34+
- (void)test_capabilitiesVisibility {
35+
NSError *error = nil;
36+
MSALNativeAuthPublicClientApplicationConfig *config = [[MSALNativeAuthPublicClientApplicationConfig alloc] initWithClientId:@"clientId" tenantSubdomain:@"tenantSubdomain" challengeTypes:MSALNativeAuthChallengeTypeOOB error:&error];
37+
config.capabilities = MSALNativeAuthCapabilityMFARequired;
38+
}
39+
40+
@end

0 commit comments

Comments
 (0)