Skip to content

Commit 3a1543d

Browse files
authored
Replaced JIT with Register Strong Auth (#2613)
* Replaced JIT with Register Strong Auth * Swiftlint * Proper IC
1 parent 13eccf3 commit 3a1543d

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

MSAL/src/native_auth/controllers/jit/MSALNativeAuthJITController.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ final class MSALNativeAuthJITController: MSALNativeAuthBaseController, MSALNativ
8282
MSALNativeAuthLogger.logPII(
8383
level: .error,
8484
context: telemetryInfo.context,
85-
format: "JIT: an error occurred after calling /introspect API: \(MSALLogMask.maskPII(error))"
85+
format: "RegisterStrongAuth: an error occurred after calling /introspect API: \(MSALLogMask.maskPII(error))"
8686
)
8787
stopTelemetryEvent(telemetryInfo, error: error)
8888
return .init(.error(error: error), correlationId: context.correlationId())
@@ -101,7 +101,7 @@ final class MSALNativeAuthJITController: MSALNativeAuthBaseController, MSALNativ
101101
authMethod: authMethod,
102102
verificationContact: verificationContact,
103103
context: context,
104-
logErrorMessage: "JIT RequestChallenge: cannot create challenge request object"
104+
logErrorMessage: "Request RegisterStrongAuth Challenge: cannot create challenge request object"
105105
)
106106
return await handleChallengeResponse(
107107
result,
@@ -122,7 +122,7 @@ final class MSALNativeAuthJITController: MSALNativeAuthBaseController, MSALNativ
122122
grantType: grantType,
123123
context: context,
124124
oobCode: challenge,
125-
logErrorMessage: "JIT RequestContinue: cannot create challenge request object"
125+
logErrorMessage: "Request RegisterStrongAuth Continue: cannot create challenge request object"
126126
)
127127
return await handleSubmitChallengeResponse(
128128
result,
@@ -196,7 +196,7 @@ final class MSALNativeAuthJITController: MSALNativeAuthBaseController, MSALNativ
196196
do {
197197
return try jitRequestProvider.introspect(parameters: params, context: context)
198198
} catch {
199-
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error creating JIT introspect request: \(error)")
199+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error creating RegisterStrongAuth Introspect Request: \(error)")
200200
return nil
201201
}
202202
}
@@ -220,7 +220,7 @@ final class MSALNativeAuthJITController: MSALNativeAuthBaseController, MSALNativ
220220
)
221221
return try jitRequestProvider.challenge(parameters: params, context: context)
222222
} catch {
223-
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error creating JIT Challenge Request: \(error)")
223+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error creating RegisterStrongAuth Challenge Request: \(error)")
224224
return nil
225225
}
226226
}
@@ -238,7 +238,7 @@ final class MSALNativeAuthJITController: MSALNativeAuthBaseController, MSALNativ
238238
do {
239239
return try jitRequestProvider.continue(parameters: params, context: context)
240240
} catch {
241-
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error creating JIT continue request: \(error)")
241+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Error creating RegisterStrongAuth Continue Request: \(error)")
242242
return nil
243243
}
244244
}
@@ -255,7 +255,7 @@ final class MSALNativeAuthJITController: MSALNativeAuthBaseController, MSALNativ
255255
MSALNativeAuthLogger.logPII(
256256
level: .error,
257257
context: context,
258-
format: "JIT request continue: received continue error response: \(MSALLogMask.maskPII(error.errorDescription))"
258+
format: "Request RegisterStrongAuth Continue: received continue error response: \(MSALLogMask.maskPII(error.errorDescription))"
259259
)
260260
stopTelemetryEvent(event, context: context, error: error)
261261
return .init(.error(
@@ -314,7 +314,7 @@ final class MSALNativeAuthJITController: MSALNativeAuthBaseController, MSALNativ
314314
MSALNativeAuthLogger.logPII(
315315
level: .error,
316316
context: context,
317-
format: "JIT request challenge: received challenge error response: \(MSALLogMask.maskPII(error.errorDescription))"
317+
format: "Request RegisterStrongAuth Challenge: received challenge error response: \(MSALLogMask.maskPII(error.errorDescription))"
318318
)
319319
stopTelemetryEvent(event, context: context, error: error)
320320
return .init(.error(

MSAL/src/native_auth/controllers/sign_in/MSALNativeAuthSignInController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ final class MSALNativeAuthSignInController: MSALNativeAuthTokenController, MSALN
159159
self.stopTelemetryEvent(telemetryInfo.event, context: context, error: error)
160160
return .init(.error(error: error), correlationId: context.correlationId())
161161
case .jitAuthMethodsSelectionRequired(let authMethods, let jitRequiredState):
162-
MSALNativeAuthLogger.log(level: .info, context: context, format: "JIT required after sing in after previous flow")
162+
MSALNativeAuthLogger.log(level: .info, context: context, format: "RegisterStrongAuth required after sing in after previous flow")
163163
return .init(
164164
.jitAuthMethodsSelectionRequired(authMethods: authMethods, newState: jitRequiredState),
165165
correlationId: context.correlationId(),
@@ -288,7 +288,7 @@ final class MSALNativeAuthSignInController: MSALNativeAuthTokenController, MSALN
288288
self?.stopTelemetryEvent(telemetryInfo.event, context: context, delegateDispatcherResult: result)
289289
})
290290
case.jitRequired(continuationToken: let newContinuationToken):
291-
MSALNativeAuthLogger.log(level: .info, context: context, format: "JIT required after submit password")
291+
MSALNativeAuthLogger.log(level: .info, context: context, format: "RegisterStrongAuth required after submit password")
292292
let jitController = createJITController()
293293
let jitIntrospectResponse = await jitController.getJITAuthMethods(continuationToken: newContinuationToken, context: context)
294294
switch jitIntrospectResponse.result {
@@ -600,7 +600,7 @@ final class MSALNativeAuthSignInController: MSALNativeAuthTokenController, MSALN
600600
return .init(.error(error: error, newState: nil), correlationId: context.correlationId())
601601
case .jitRequired:
602602
let error = VerifyCodeError(type: .generalError, correlationId: context.correlationId())
603-
MSALNativeAuthLogger.log(level: .error, context: context, format: "Submit code: received unexpected JIT required API result")
603+
MSALNativeAuthLogger.log(level: .error, context: context, format: "Submit code: received unexpected RegisterStrongAuth required API result") // swiftlint:disable:this line_length
604604
stopTelemetryEvent(telemetryInfo.event, context: context, error: error)
605605
return .init(.error(error: error, newState: nil), correlationId: context.correlationId())
606606
}
@@ -786,7 +786,7 @@ final class MSALNativeAuthSignInController: MSALNativeAuthTokenController, MSALN
786786
MSALNativeAuthLogger.log(level: .info, context: telemetryInfo.context, format: "Multi factor authentication required")
787787
return .awaitingMFA(state)
788788
case .jitRequired(let continuationToken):
789-
MSALNativeAuthLogger.log(level: .info, context: telemetryInfo.context, format: "JIT required.")
789+
MSALNativeAuthLogger.log(level: .info, context: telemetryInfo.context, format: "RegisterStrongAuth required.")
790790
let jitController = createJITController()
791791
let jitIntrospectResponse = await jitController.getJITAuthMethods(continuationToken: continuationToken,
792792
context: telemetryInfo.context)

MSAL/src/native_auth/network/responses/validator/token/MSALNativeAuthTokenResponseValidator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ final class MSALNativeAuthTokenResponseValidator: MSALNativeAuthTokenResponseVal
116116
MSALNativeAuthLogger.log(
117117
level: .error,
118118
context: context,
119-
format: "Token: JIT required response, expected continuation token not empty")
119+
format: "Token: RegisterStrongAuth required response, expected continuation token not empty")
120120
return .error(.generalError(
121121
MSALNativeAuthTokenResponseError(errorDescription: MSALNativeAuthErrorMessage.unexpectedResponseBody)
122122
))

MSAL/src/native_auth/public/state_machine/state/JITStates+Internal.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extension RegisterStrongAuthBaseState {
2727
verificationContact: String?) async -> MSALNativeAuthJITControlling.JITRequestChallengeControllerResponse {
2828
let context = MSALNativeAuthRequestContext(correlationId: correlationId)
2929
MSALNativeAuthLogger.log(level: .warning, context: context, format: MSALNativeAuthLogMessage.privatePreviewLog)
30-
MSALNativeAuthLogger.log(level: .info, context: context, format: "JIT, request challenge")
30+
MSALNativeAuthLogger.log(level: .info, context: context, format: "RegisterStrongAuth, Request Challenge")
3131
return await controller.requestJITChallenge(continuationToken: continuationToken,
3232
authMethod: authMethod,
3333
verificationContact: verificationContact,
@@ -40,9 +40,9 @@ extension RegisterStrongAuthVerificationRequiredState {
4040
func submitChallengeInternal(challenge: String) async -> MSALNativeAuthJITControlling.JITSubmitChallengeControllerResponse {
4141
let context = MSALNativeAuthRequestContext(correlationId: correlationId)
4242
MSALNativeAuthLogger.log(level: .warning, context: context, format: MSALNativeAuthLogMessage.privatePreviewLog)
43-
MSALNativeAuthLogger.log(level: .info, context: context, format: "JIT, submit challenge")
43+
MSALNativeAuthLogger.log(level: .info, context: context, format: "RegisterStrongAuth, Submit Challenge")
4444
guard inputValidator.isInputValid(challenge) else {
45-
MSALNativeAuthLogger.log(level: .error, context: context, format: "JIT, invalid challenge")
45+
MSALNativeAuthLogger.log(level: .error, context: context, format: "RegisterStrongAuth, invalid challenge")
4646
return .init(
4747
.error(error: RegisterStrongAuthSubmitChallengeError(type: .invalidChallenge, correlationId: correlationId), newState: self),
4848
correlationId: context.correlationId()

0 commit comments

Comments
 (0)