-
Notifications
You must be signed in to change notification settings - Fork 887
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
Expose error response json in case extra parameters are given. #885
base: master
Are you sure you want to change the base?
Changes from all commits
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 | ||||
---|---|---|---|---|---|---|
|
@@ -464,22 +464,22 @@ public static AuthorizationException byString(String error) { | |||||
|
||||||
private static AuthorizationException generalEx(int code, @Nullable String errorDescription) { | ||||||
return new AuthorizationException( | ||||||
TYPE_GENERAL_ERROR, code, null, errorDescription, null, null); | ||||||
TYPE_GENERAL_ERROR, code, null, errorDescription, null, null, null); | ||||||
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. General error 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. Errodescriåtipn null null null 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. 467+ 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. +467 to +465 |
||||||
} | ||||||
|
||||||
private static AuthorizationException authEx(int code, @Nullable String error) { | ||||||
return new AuthorizationException( | ||||||
TYPE_OAUTH_AUTHORIZATION_ERROR, code, error, null, null, null); | ||||||
TYPE_OAUTH_AUTHORIZATION_ERROR, code, error, null, null, null, null); | ||||||
} | ||||||
|
||||||
private static AuthorizationException tokenEx(int code, @Nullable String error) { | ||||||
return new AuthorizationException( | ||||||
TYPE_OAUTH_TOKEN_ERROR, code, error, null, null, null); | ||||||
TYPE_OAUTH_TOKEN_ERROR, code, error, null, null, null, null); | ||||||
} | ||||||
|
||||||
private static AuthorizationException registrationEx(int code, @Nullable String error) { | ||||||
return new AuthorizationException( | ||||||
TYPE_OAUTH_REGISTRATION_ERROR, code, error, null, null, null); | ||||||
TYPE_OAUTH_REGISTRATION_ERROR, code, error, null, null, null, null); | ||||||
} | ||||||
|
||||||
/** | ||||||
|
@@ -496,6 +496,7 @@ public static AuthorizationException fromTemplate( | |||||
ex.error, | ||||||
ex.errorDescription, | ||||||
ex.errorUri, | ||||||
ex.responseJson, | ||||||
rootCause); | ||||||
} | ||||||
|
||||||
|
@@ -508,13 +509,15 @@ public static AuthorizationException fromOAuthTemplate( | |||||
@NonNull AuthorizationException ex, | ||||||
@Nullable String errorOverride, | ||||||
@Nullable String errorDescriptionOverride, | ||||||
@Nullable Uri errorUriOverride) { | ||||||
@Nullable Uri errorUriOverride, | ||||||
@Nullable JSONObject responseJson) { | ||||||
return new AuthorizationException( | ||||||
ex.type, | ||||||
ex.code, | ||||||
(errorOverride != null) ? errorOverride : ex.error, | ||||||
(errorDescriptionOverride != null) ? errorDescriptionOverride : ex.errorDescription, | ||||||
(errorUriOverride != null) ? errorUriOverride : ex.errorUri, | ||||||
responseJson, | ||||||
null); | ||||||
} | ||||||
|
||||||
|
@@ -533,6 +536,7 @@ public static AuthorizationException fromOAuthRedirect( | |||||
error, | ||||||
errorDescription != null ? errorDescription : base.errorDescription, | ||||||
errorUri != null ? Uri.parse(errorUri) : base.errorUri, | ||||||
base.responseJson, | ||||||
null); | ||||||
} | ||||||
|
||||||
|
@@ -559,6 +563,7 @@ public static AuthorizationException fromJson(@NonNull JSONObject json) throws J | |||||
JsonUtil.getStringIfDefined(json, KEY_ERROR), | ||||||
JsonUtil.getStringIfDefined(json, KEY_ERROR_DESCRIPTION), | ||||||
JsonUtil.getUriIfDefined(json, KEY_ERROR_URI), | ||||||
json, | ||||||
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.
Suggested change
And toJson is missing the reponseJson field serialization: // Line 663
JsonUtil.putIfNotNull(json, KEY_ERROR_URI, errorUri);
JsonUtil.putIfNotNull(json, KEY_RESPONSE_JSON, responseJson);
return json; |
||||||
null); | ||||||
} | ||||||
|
||||||
|
@@ -631,6 +636,12 @@ private static Map<String, AuthorizationException> exceptionMapByString( | |||||
@Nullable | ||||||
public final Uri errorUri; | ||||||
|
||||||
/** | ||||||
* The raw error json object | ||||||
*/ | ||||||
@Nullable | ||||||
public final JSONObject responseJson; | ||||||
|
||||||
/** | ||||||
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. Add corresponding field for serialization // Line 142
@VisibleForTesting
static final String KEY_RESPONSE_JSON = "responseJson"; |
||||||
* Instantiates an authorization request with optional root cause information. | ||||||
*/ | ||||||
|
@@ -640,13 +651,15 @@ public AuthorizationException( | |||||
@Nullable String error, | ||||||
@Nullable String errorDescription, | ||||||
@Nullable Uri errorUri, | ||||||
@Nullable JSONObject responseJson, | ||||||
@Nullable Throwable rootCause) { | ||||||
super(errorDescription, rootCause); | ||||||
this.type = type; | ||||||
this.code = code; | ||||||
this.error = error; | ||||||
this.errorDescription = errorDescription; | ||||||
this.errorUri = errorUri; | ||||||
this.responseJson = responseJson; | ||||||
} | ||||||
|
||||||
/** | ||||||
|
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.
467
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.
Null