-
Notifications
You must be signed in to change notification settings - Fork 148
Native auth: add new SDK error when authentication method is blocked #2734
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds new SDK error handling for when authentication methods are blocked (error code 550024), expanding the existing error handling system to provide more specific error types and messages when authentication methods or verification contacts are blocked by the server.
- Added a new error type
authMethodBlocked
to the MFA request challenge error system - Added a new error type
verificationContactBlocked
to the registration strong auth challenge error system - Updated response validators to recognize error code 550024 and map it to appropriate blocked error types
Reviewed Changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
MFARequestChallengeError.swift | Converted from generic error to specific error class with authMethodBlocked type |
RegisterStrongAuthChallengeError.swift | Added verificationContactBlocked error type |
MSALNativeAuthErrorMessage.swift | Added error messages for blocked authentication methods |
MSALNativeAuthESTSApiErrorCodes.swift | Added error code 550024 for authMethodBlocked |
Various validator files | Updated to handle error code 550024 and return appropriate blocked error types |
Test files | Added comprehensive test coverage for the new error scenarios |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
MSAL/src/native_auth/public/state_machine/error/MFARequestChallengeError.swift
Show resolved
Hide resolved
.../native_auth/network/responses/validator/sign_in/MSALNativeAuthSignInResponseValidator.swift
Show resolved
Hide resolved
MSAL/src/native_auth/network/responses/validator/jit/MSALNativeAuthJITResponseValidator.swift
Show resolved
Hide resolved
MSAL/src/native_auth/controllers/sign_in/MSALNativeAuthSignInController.swift
Show resolved
Hide resolved
let knownErrorCode = MSALNativeAuthESTSApiErrorCodes(rawValue: errorCode), | ||
knownErrorCode == .invalidVerificationContact else { | ||
if error.errorCodes?.contains(MSALNativeAuthESTSApiErrorCodes.authMethodBlocked.rawValue) == true { | ||
let customErrorDescription = MSALNativeAuthErrorMessage.verificationContactBlocked + (error.errorDescription ?? "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be it MSALNativeAuthErrorMessage.authMethodBlocked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The auth method blocked message is for the MFA flow. We differentiate the error messages, because the user should act differently between the two errors.
Proposed changes
Add new SDK error when authentication method is blocked
Type of change
Risk