-
Notifications
You must be signed in to change notification settings - Fork 35
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
Error code & other related tasks refactoring #153
Changes from 2 commits
59dedf2
5305f64
1370486
fb06c85
1a4a89f
79f415f
26fcc80
d26da5a
258ce69
f383235
abb22c7
92ec263
f14de0e
d49dd2e
bbd6375
6b87210
3672f38
3117678
089ec9f
9acc5b8
330fcd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,77 +41,95 @@ extern NSString *MSIDKeychainErrorDomain; | |
|
||
typedef NS_ENUM(NSInteger, MSIDErrorCode) | ||
{ | ||
/*! ================================================= | ||
General Errors (510xx, 511xx) | ||
================================================= */ | ||
// General internal errors that do not fall into one of the specific type | ||
// of an error described below. | ||
MSIDErrorInternal = -51000, | ||
MSIDErrorInvalidInternalParameter = -51001, | ||
|
||
MSIDErrorInvalidDeveloperParameter = -51002, | ||
MSIDErrorAmbiguousAuthority = -51003, | ||
MSIDErrorInteractionRequired = -51004, | ||
// Parameter errors | ||
MSIDErrorInvalidInternalParameter = -51101, | ||
MSIDErrorInvalidDeveloperParameter = -51102, | ||
|
||
// Unsupported functionality | ||
MSIDErrorUnsupportedFunctionality = -51199, | ||
|
||
MSIDErrorCacheMultipleUsers = -51005, | ||
/*! | ||
================================================= | ||
Cache Errors (512xx, | ||
513xx - Keychain) | ||
================================================= | ||
*/ | ||
|
||
// Multiple users found in cache when one was intended | ||
MSIDErrorCacheMultipleUsers = -51201, | ||
|
||
/*! | ||
MSID encounted an error when trying to store or retrieve items from | ||
keychain. Inspect NSUnderlyingError from the userInfo dictionary for | ||
more information about the specific error. Keychain error codes are | ||
documented in Apple's <Security/SecBase.h> header file | ||
*/ | ||
MSIDErrorTokenCacheItemFailure = -51006, | ||
MSIDErrorWrapperCacheFailure = -51007, | ||
MSIDErrorCacheBadFormat = -51008, | ||
MSIDErrorCacheVersionMismatch = -51009, | ||
MSIDErrorTokenCacheItemFailure = -51301, | ||
MSIDErrorWrapperCacheFailure = -51302, | ||
MSIDErrorCacheBadFormat = -51303, | ||
MSIDErrorCacheVersionMismatch = -51304, | ||
|
||
MSIDErrorServerInvalidResponse = -51010, | ||
MSIDErrorDeveloperAuthorityValidation = -51011, | ||
MSIDErrorServerRefreshTokenRejected = -51012, | ||
MSIDErrorServerOauth = -51013, | ||
MSIDErrorInvalidRequest = -51014, | ||
MSIDErrorInvalidClient = -51015, | ||
MSIDErrorInvalidGrant = -51016, | ||
MSIDErrorInvalidScope = -51017, | ||
MSIDErrorInvalidParameter = -51018, | ||
/*! | ||
================================================= | ||
Server errors (514xx) | ||
================================================= | ||
*/ | ||
// Server returned a response indicating an OAuth error | ||
MSIDErrorServerOauth = -51401, | ||
// Server returned an invalid response | ||
MSIDErrorServerInvalidResponse = -51402, | ||
// Server returned a refresh token reject response | ||
MSIDErrorServerRefreshTokenRejected = -51403, | ||
// Other specific server response errors | ||
MSIDErrorInvalidRequest = -51404, | ||
MSIDErrorInvalidClient = -51405, | ||
MSIDErrorInvalidGrant = -51406, | ||
MSIDErrorInvalidScope = -51407, | ||
|
||
/*! | ||
================================================= | ||
Interactive flow errors (515xx) | ||
================================================= | ||
*/ | ||
/*! | ||
The user or application failed to authenticate in the interactive flow. | ||
Inspect MSALOAuthErrorKey and MSALErrorDescriptionKey in the userInfo | ||
dictionary for more detailed information about the specific error. | ||
*/ | ||
MSIDErrorAuthorizationFailed = -52020, | ||
MSIDErrorAuthorizationFailed = -51510, | ||
|
||
/*! | ||
The state returned by the server does not match the state that was sent to | ||
the server at the beginning of the authorization attempt. | ||
*/ | ||
MSIDErrorInvalidState = -52501, | ||
/*! | ||
Interaction required errors occur because of a wide variety of errors | ||
returned by the authentication service. | ||
*/ | ||
MSIDErrorMismatchedUser = -52101, | ||
MSIDErrorNoAuthorizationResponse = -52102, | ||
MSIDErrorBadAuthorizationResponse = -52103, | ||
// State verification has failed in the interactive flow. | ||
MSIDErrorInvalidState = -51511, | ||
|
||
// User has cancelled the interactive flow. | ||
MSIDErrorUserCancel = -51512, | ||
|
||
MSIDErrorUserCancel = -51019, | ||
/*! | ||
The authentication request was cancelled programmatically. | ||
*/ | ||
MSIDErrorSessionCanceled = -51020, | ||
// The interactive flow was cancelled programmatically. | ||
MSIDErrorSessionCanceled = -51513, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can the error name "hint" that it was canceled programmatically? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
// Interactive authentication session failed to start. | ||
MSIDErrorInteractiveSessionStartFailure = -51514, | ||
/*! | ||
An interactive authentication session is already running with the | ||
SafariViewController visible. Another authentication session can not be | ||
launched yet. | ||
An interactive authentication session is already running. | ||
Another authentication session can not be launched yet. | ||
*/ | ||
MSIDErrorInteractiveSessionAlreadyRunning = -51021, | ||
MSIDErrorInteractiveSessionAlreadyRunning = -51515, | ||
|
||
/*! | ||
An interactive authentication session failed to start. | ||
================================================= | ||
Boundaries - To be used to enumerate all codes | ||
================================================= | ||
*/ | ||
MSIDErrorInteractiveSessionStartFailure = -51022, | ||
|
||
MSIDErrorUnsupportedFunctionality = -51018, | ||
|
||
MSIDErrorCodeFirst = MSIDErrorInternal, | ||
MSIDErrorCodeLast = MSIDErrorUnsupportedFunctionality | ||
MSIDErrorCodeLast = MSIDErrorInteractiveSessionAlreadyRunning | ||
|
||
}; | ||
|
||
extern NSError *MSIDCreateError(NSString *domain, NSInteger code, NSString *errorDescription, NSString *oauthError, NSString *subError, NSError *underlyingError, NSUUID *correlationId, NSDictionary *additionalUserInfo); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,7 +101,7 @@ - (MSIDAccountType)accountType | |
|
||
- (MSIDErrorCode)oauthErrorCode | ||
{ | ||
return MSIDErrorCodeForOAuthError(self.error, MSIDErrorInteractionRequired); | ||
return MSIDErrorCodeForOAuthError(self.error, MSIDErrorServerOauth); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will the clients know to show UI on MSIDErrorServerOauth? I think the reason to have MSIDErrorInteractionRequired as default is so that client show UI in MSAL? Can we check what was MSAL and ADAL implementation before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Top level : Interaction required and double check converter in MSAL and ADAL |
||
} | ||
|
||
- (NSDictionary *)additionalServerInfo | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,10 @@ - (instancetype)initWithURL:(NSURL *)url | |
{ | ||
if (error) | ||
{ | ||
*error = MSIDCreateError(MSIDOAuthErrorDomain, MSIDErrorInvalidParameter, @"Unexpected error has occured. There is no auth code nor an error", nil, nil, nil, context.correlationId, nil); | ||
*error = MSIDCreateError(MSIDOAuthErrorDomain, | ||
MSIDErrorServerInvalidResponse, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
@"Unexpected error has occured. There is no auth code nor an error", | ||
nil, nil, nil, context.correlationId, nil); | ||
} | ||
return nil; | ||
} | ||
|
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.
nit: should it also have "server" in it?
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.
done