-
Notifications
You must be signed in to change notification settings - Fork 11
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
Added API error response handling #13
Conversation
This is certainly a welcome addition |
@cainlevy not directly related to this PR but while using authn-go in a SSO environment I had a problem with audience verification and "fixed" that in the last commit here. I can remove that change and create a new PR if you like. Here's the problem I had: I'm using authn-server for the authentication part at, let's say, In addition, I'm having an identity and access management server at
Unfortunately I didn't find a way to tell authn-server to add an additional audience to every token (if there is, please point me to the docs) so I went with the second one. Here's the problem, authn-go always sets |
@ppacher would it be appropriate to configure your (if there's more to discuss here we should open a separate issue to track the conversation) |
@cainlevy configuring Although I'd prefer the whitelist approach I also think that support to disable audience verification would be a helpful addition to authn-go |
I created a dedicated issue for this discussion and will revert the last commit for now |
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.
I think this changeset will be ready after test cases and cleanup 👍
I'll try to get the test cases running on the weekend. Would you expect that all test-cases in |
My preference is to test the public API, but I'm content to pick any function that might error as a canary for the expected behavior. |
Added the test cases. If you like something changed just tell me |
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.
looks good, thanks!
This PR adds a custom error type that is populated with the field errors returned by the API.
With this changes it's easier to debug why the authn-server replied with 4xx or 5xx status codes and allows to inspect the error returned:
I've not yet updated the test-cases because it would require returning a JSON object for errors and not just a statusCode and wanted to ask if you would even consider merging this PR.
Thanks