Skip to content

Commit 2319cc0

Browse files
authored
Merge branch 'dev' into yuki/remove-legacy-interface
2 parents bb310d5 + a9f918b commit 2319cc0

29 files changed

+343
-312
lines changed

MSAL/MSAL.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,8 @@
14351435
DEE34F8DD170B71C00BC302A /* MSALNativeAuthResetPasswordPollCompletionResponseError.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEE34F8BD170B71C00BC302A /* MSALNativeAuthResetPasswordPollCompletionResponseError.swift */; };
14361436
DEE34F96D170B71C00BC302A /* MSALNativeAuthRequiredAttributeInternal.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEE34F95D170B71C00BC302A /* MSALNativeAuthRequiredAttributeInternal.swift */; };
14371437
DEE34FA1D170B71C00BC302A /* MSALNativeAuthResetPasswordRequestProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEE34FA0D170B71C00BC302A /* MSALNativeAuthResetPasswordRequestProvider.swift */; };
1438+
DEEFCE552DB0FA4800237F5A /* MSALNativeAuthLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEFCE542DB0FA4300237F5A /* MSALNativeAuthLogger.swift */; };
1439+
DEEFCE562DB0FA4800237F5A /* MSALNativeAuthLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEFCE542DB0FA4300237F5A /* MSALNativeAuthLogger.swift */; };
14381440
DEF1DD322AA9CBC300D22194 /* MSALNativeAuthESTSApiErrorDescriptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF1DD312AA9CBC300D22194 /* MSALNativeAuthESTSApiErrorDescriptions.swift */; };
14391441
DEF1DD3C2AA9D07000D22194 /* MSALNativeAuthESTSApiErrorDescriptionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF1DD3B2AA9D07000D22194 /* MSALNativeAuthESTSApiErrorDescriptionsTests.swift */; };
14401442
DEF9D989296EC26A006CB384 /* MSALNativeAuthCurrentRequestTelemetry.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF9D988296EC26A006CB384 /* MSALNativeAuthCurrentRequestTelemetry.swift */; };
@@ -2568,6 +2570,7 @@
25682570
DEE34F8BD170B71C00BC302A /* MSALNativeAuthResetPasswordPollCompletionResponseError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthResetPasswordPollCompletionResponseError.swift; sourceTree = "<group>"; };
25692571
DEE34F95D170B71C00BC302A /* MSALNativeAuthRequiredAttributeInternal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthRequiredAttributeInternal.swift; sourceTree = "<group>"; };
25702572
DEE34FA0D170B71C00BC302A /* MSALNativeAuthResetPasswordRequestProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthResetPasswordRequestProvider.swift; sourceTree = "<group>"; };
2573+
DEEFCE542DB0FA4300237F5A /* MSALNativeAuthLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthLogger.swift; sourceTree = "<group>"; };
25712574
DEF1DD312AA9CBC300D22194 /* MSALNativeAuthESTSApiErrorDescriptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthESTSApiErrorDescriptions.swift; sourceTree = "<group>"; };
25722575
DEF1DD3B2AA9D07000D22194 /* MSALNativeAuthESTSApiErrorDescriptionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthESTSApiErrorDescriptionsTests.swift; sourceTree = "<group>"; };
25732576
DEF9D988296EC26A006CB384 /* MSALNativeAuthCurrentRequestTelemetry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthCurrentRequestTelemetry.swift; sourceTree = "<group>"; };
@@ -4726,6 +4729,7 @@
47264729
DECC1F9329521E34006D9FB1 /* MSALLogMask.h */,
47274730
DECC1F9229521E34006D9FB1 /* MSALLogMask.m */,
47284731
E26097C22948FC4D0060DD7C /* MSALNativeAuthLogging.swift */,
4732+
DEEFCE542DB0FA4300237F5A /* MSALNativeAuthLogger.swift */,
47294733
);
47304734
path = logger;
47314735
sourceTree = "<group>";
@@ -6735,6 +6739,7 @@
67356739
DE03478A2A39ED6A003CB3B6 /* MSALCIAMOauth2Provider.m in Sources */,
67366740
E205D62E29B783FF003887BC /* MSALNativeAuthConfiguration.swift in Sources */,
67376741
D61BD2B21EBD09F90007E484 /* MSALAccount.m in Sources */,
6742+
DEEFCE562DB0FA4800237F5A /* MSALNativeAuthLogger.swift in Sources */,
67386743
DE0D65B629CC6BBA005798B1 /* MSALNativeAuthSignInChallengeResponse.swift in Sources */,
67396744
E2F890052B755355001FBC7C /* MSALNativeAuthUnknownCaseProtocol.swift in Sources */,
67406745
E2EFAD092A69A34300D6C3DE /* CodeRequiredGenericResult.swift in Sources */,
@@ -7051,6 +7056,7 @@
70517056
B2A3C28C2145FD0F0082525C /* MSALAccountsProvider.m in Sources */,
70527057
DE8DC4D52C6621CC00534E8F /* MSALNativeAuthSignUpChallengeResponseError.swift in Sources */,
70537058
DE4315102D3E551F009A7FA2 /* MSALNativeAuthGetAccessTokenParameters.swift in Sources */,
7059+
DEEFCE552DB0FA4800237F5A /* MSALNativeAuthLogger.swift in Sources */,
70547060
DE4315112D3E551F009A7FA2 /* MSALNativeAuthSignInParameters.swift in Sources */,
70557061
DE4315122D3E551F009A7FA2 /* MSALNativeAuthSignUpParameters.swift in Sources */,
70567062
DE4315132D3E551F009A7FA2 /* MSALNativeAuthSignInAfterSignUpParameters.swift in Sources */,

MSAL/src/native_auth/controllers/MSALNativeAuthBaseController.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class MSALNativeAuthBaseController {
6969

7070
func startTelemetryEvent(_ localEvent: MSIDTelemetryAPIEvent?, context: MSIDRequestContext) {
7171
guard let eventName = localEvent?.property(withName: MSID_TELEMETRY_KEY_EVENT_NAME) else {
72-
return MSALLogger.log(
72+
return MSALNativeAuthLogger.log(
7373
level: .error,
7474
context: context,
7575
format: "Telemetry event nil not expected"
@@ -88,7 +88,7 @@ class MSALNativeAuthBaseController {
8888

8989
func stopTelemetryEvent(_ localEvent: MSIDTelemetryAPIEvent?, context: MSIDRequestContext, error: Error? = nil) {
9090
guard let event = localEvent else {
91-
return MSALLogger.log(
91+
return MSALNativeAuthLogger.log(
9292
level: .error,
9393
context: context,
9494
format: "Telemetry event nil not expected"
@@ -133,7 +133,7 @@ class MSALNativeAuthBaseController {
133133
case .success:
134134
stopTelemetryEvent(event, context: context, error: controllerError)
135135
case .failure(let error):
136-
MSALLogger.logPII(level: .error, context: context, format: "Error \(MSALLogMask.maskPII(error.errorDescription))")
136+
MSALNativeAuthLogger.logPII(level: .error, context: context, format: "Error \(MSALLogMask.maskPII(error.errorDescription))")
137137
stopTelemetryEvent(event, context: context, error: error)
138138
}
139139
}
@@ -169,15 +169,15 @@ class MSALNativeAuthBaseController {
169169
context.setServerCorrelationId(correlationId)
170170
} else {
171171
context.setServerCorrelationId(nil)
172-
MSALLogger.log(level: .warning, context: context, format: "Error request - cannot decode error headers. Continuing")
172+
MSALNativeAuthLogger.log(level: .warning, context: context, format: "Error request - cannot decode error headers. Continuing")
173173
}
174174

175175
continuation.resume(returning: .failure(error))
176176
} else if let response = result as? T {
177177
context.setServerCorrelationId(response.correlationId)
178178
continuation.resume(returning: .success(response))
179179
} else {
180-
MSALLogger.log(level: .error, context: context, format: "Error request - Both result and error are nil")
180+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error request - Both result and error are nil")
181181
continuation.resume(returning: .failure(MSALNativeAuthInternalError.invalidResponse))
182182
}
183183
}

MSAL/src/native_auth/controllers/MSALNativeAuthTokenController.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class MSALNativeAuthTokenController: MSALNativeAuthBaseController {
9797
claimsRequestJson: claimsRequestJson)
9898
return try requestProvider.signInWithPassword(parameters: params, context: context)
9999
} catch {
100-
MSALLogger.log(level: .error, context: context, format: "Error creating SignIn Token Request: \(error)")
100+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error creating SignIn Token Request: \(error)")
101101
return nil
102102
}
103103
}
@@ -107,7 +107,7 @@ class MSALNativeAuthTokenController: MSALNativeAuthBaseController {
107107
refreshToken: String?,
108108
context: MSALNativeAuthRequestContext) -> MSIDHttpRequest? {
109109
guard let refreshToken = refreshToken else {
110-
MSALLogger.log(level: .error, context: context, format: "Error creating Refresh Token Request, refresh token is nil!")
110+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error creating Refresh Token Request, refresh token is nil!")
111111
return nil
112112
}
113113
do {
@@ -124,7 +124,7 @@ class MSALNativeAuthTokenController: MSALNativeAuthBaseController {
124124
claimsRequestJson: nil)
125125
return try requestProvider.refreshToken(parameters: params, context: context)
126126
} catch {
127-
MSALLogger.log(level: .error, context: context, format: "Error creating Refresh Token Request: \(error)")
127+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error creating Refresh Token Request: \(error)")
128128
return nil
129129
}
130130
}
@@ -138,21 +138,21 @@ class MSALNativeAuthTokenController: MSALNativeAuthBaseController {
138138
let homeAccountId = tokenResponse.idTokenObj?.userId
139139

140140
guard let accountIdentifier = MSIDAccountIdentifier(displayableId: displayableId, homeAccountId: homeAccountId) else {
141-
MSALLogger.log(level: .error, context: context, format: "Error creating account identifier")
141+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error creating account identifier")
142142
throw MSALNativeAuthInternalError.invalidResponse
143143
}
144144

145145
guard let result = cacheTokenResponseRetrieveTokenResult(tokenResponse,
146146
context: context,
147147
msidConfiguration: msidConfiguration) else {
148-
MSALLogger.log(level: .error, context: context, format: "Error caching token response")
148+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error caching token response")
149149
throw MSALNativeAuthInternalError.invalidResponse
150150
}
151151

152152
guard try responseValidator.validateAccount(with: result,
153153
context: context,
154154
accountIdentifier: accountIdentifier) else {
155-
MSALLogger.log(level: .error, context: context, format: "Error validating account")
155+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error validating account")
156156
throw MSALNativeAuthInternalError.invalidResponse
157157
}
158158

@@ -173,15 +173,15 @@ extension MSALNativeAuthTokenController {
173173
// If there is an account existing already in the cache, we remove it
174174
try clearAccount(msidConfiguration: msidConfiguration, context: context)
175175
} catch {
176-
MSALLogger.logPII(level: .warning, context: context, format: "Error clearing account \(MSALLogMask.maskEUII(error)) (ignoring)")
176+
MSALNativeAuthLogger.logPII(level: .warning, context: context, format: "Error clearing account \(MSALLogMask.maskEUII(error)) (ignoring)")
177177
}
178178
do {
179179
let result = try cacheAccessor.validateAndSaveTokensAndAccount(tokenResponse: tokenResponse,
180180
configuration: msidConfiguration,
181181
context: context)
182182
return result
183183
} catch {
184-
MSALLogger.logPII(level: .warning, context: context, format: "Error caching response: \(MSALLogMask.maskEUII(error)) (ignoring)")
184+
MSALNativeAuthLogger.logPII(level: .warning, context: context, format: "Error caching response: \(MSALLogMask.maskEUII(error)) (ignoring)")
185185
}
186186
return nil
187187
}
@@ -197,12 +197,12 @@ extension MSALNativeAuthTokenController {
197197
context: context)
198198
}
199199
} else {
200-
MSALLogger.log(level: .warning,
200+
MSALNativeAuthLogger.log(level: .warning,
201201
context: context,
202202
format: "Error creating MSIDAccountIdentifier out of MSALAccount (ignoring)")
203203
}
204204
} catch {
205-
MSALLogger.log(level: .warning, context: context, format: "Error clearing previous account (ignoring)")
205+
MSALNativeAuthLogger.log(level: .warning, context: context, format: "Error clearing previous account (ignoring)")
206206
}
207207
}
208208

@@ -222,7 +222,7 @@ extension MSALNativeAuthTokenController {
222222
tokenResponse.correlationId = request.context?.correlationId().uuidString
223223
continuation.resume(returning: .success(tokenResponse))
224224
} catch {
225-
MSALLogger.log(level: .error, context: context, format: "Error token request - Both result and error are nil")
225+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error token request - Both result and error are nil")
226226
continuation.resume(returning: .failure(MSALNativeAuthInternalError.invalidResponse))
227227
}
228228
}

MSAL/src/native_auth/controllers/credentials/MSALNativeAuthCredentialsController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ final class MSALNativeAuthCredentialsController: MSALNativeAuthTokenController,
7272
guard let rawIdToken = retrieveIdToken(account: account,
7373
scopes: [],
7474
context: context) else {
75-
MSALLogger.log(level: .verbose, context: context, format: "No Id token found")
75+
MSALNativeAuthLogger.log(level: .verbose, context: context, format: "No Id token found")
7676
return nil
7777
}
7878
return factory.makeUserAccountResult(account: account, rawIdToken: rawIdToken)
7979
} else {
80-
MSALLogger.log(level: .verbose, context: nil, format: "No account found")
80+
MSALNativeAuthLogger.log(level: .verbose, context: nil, format: "No account found")
8181
}
8282
return nil
8383
}
@@ -91,7 +91,7 @@ final class MSALNativeAuthCredentialsController: MSALNativeAuthTokenController,
9191
let config = factory.makeMSIDConfiguration(scopes: [])
9292
return try cacheAccessor.getAllAccounts(configuration: config)
9393
} catch {
94-
MSALLogger.logPII(
94+
MSALNativeAuthLogger.logPII(
9595
level: .error,
9696
context: nil,
9797
format: "Error retrieving accounts \(MSALLogMask.maskEUII(error))")
@@ -108,7 +108,7 @@ final class MSALNativeAuthCredentialsController: MSALNativeAuthTokenController,
108108
let config = factory.makeMSIDConfiguration(scopes: scopes)
109109
return try cacheAccessor.getIdToken(account: account, configuration: config, context: context)
110110
} catch {
111-
MSALLogger.log(
111+
MSALNativeAuthLogger.log(
112112
level: .error,
113113
context: context,
114114
format: "Error retrieving IdToken"

MSAL/src/native_auth/controllers/factories/MSALNativeAuthResultFactory.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ final class MSALNativeAuthResultFactory: MSALNativeAuthResultBuildable {
5353
let claims = try MSIDIdTokenClaims.init(rawIdToken: tokenResult.rawIdToken)
5454
jsonDictionary = claims.jsonDictionary()
5555
if jsonDictionary == nil {
56-
MSALLogger.log(
56+
MSALNativeAuthLogger.log(
5757
level: .warning,
5858
context: context,
5959
format: "Initialising account without claims")
6060
}
6161
} catch {
62-
MSALLogger.logPII(
62+
MSALNativeAuthLogger.logPII(
6363
level: .warning,
6464
context: context,
6565
format: "Claims for account could not be created - \(MSALLogMask.maskEUII(error))" )

0 commit comments

Comments
 (0)