KNOX-3424: Switch to JSON error messages in Knox token validation paths - #1354
KNOX-3424: Switch to JSON error messages in Knox token validation paths#1354hanicz wants to merge 2 commits into
Conversation
Test Results 4 files 4 suites 12s ⏱️ Results for commit a87272e. ♻️ This comment has been updated with latest results. |
hsheinblatt
left a comment
There was a problem hiding this comment.
Thanks Tamás. LGTM. I think a couple of the error types might be incorrect, and there may be a missing test -- see comments -- but looks to make it spec compliant.
I made some changes to address your comments.
As per RFC 8693 §2.2.2: If the request itself is not valid or if either the subject_token or actor_token are invalid for any reason, or are unacceptable based on policy, the authorization server MUST construct an error response, as specified in Section 5.2 of [RFC6749]. The value of the error parameter MUST be the invalid_request error code. Due to the above |
KNOX-3423 - Switch to JSON error messages in Knox token validation paths
What changes were proposed in this pull request?
RFC 8693 §2.2.2 / RFC 6749 §5.2 require OAuth token-exchange errors to be a JSON
body (
{"error", "error_description"}) withContent-Type: application/json.JWTFederationFilterpreviously emitted plain-text/HTML (sendError) for everypath, breaking standards-compliant clients.
body with
Cache-Control: no-store/Pragma: no-cache. HTTP status codes areunchanged (400 for param/nbf/audience, 401 for signature/expiry/parse).
TOKEN_EXCHANGE_REQUEST_ATTR: both the direct param/parse errors inTokenExchangeHandlerand the shared JWT-validation errors emitted byAbstractJWTFilter(expired / bad-signature / wrong-audience / …). The latter isthe gap a handler-only fix would miss.
plain text.
How was this patch tested?
Unit tests, local tests
Integration Tests
N/A
UI changes
N/A