Skip to content
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

Fix/jwt errorhandling #1362

Merged
merged 6 commits into from
Jul 8, 2016
Merged

Fix/jwt errorhandling #1362

merged 6 commits into from
Jul 8, 2016

Conversation

Tieske
Copy link
Member

@Tieske Tieske commented Jul 4, 2016

replaces #1247, see also #1244.

-- Decode token to find out who the consumer is
local jwt, err = jwt_decoder:new(token)
if err then
-- TODO: is this an internal server error? the token is invalid/cannot be parsed so isn't this a user error to be reported?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thibaultcha ^^

The possible errors originate here

They seem user errors to me, any specific reason they are set to fail with a 500?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah those are user errors indeed.

@Tieske
Copy link
Member Author

Tieske commented Jul 4, 2016

@thibaultcha both remarks updated


if self.params.algorithm == "HS256" and self.params.secret == nil then
return helpers.responses.send_HTTP_BAD_REQUEST("No mandatory 'secret'")
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API is not the right place to perform schema validation. Schema validation must be performed at the Model layer, aka in the schema.lua file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx, I see what you mean!

Tieske and others added 2 commits July 8, 2016 10:21
@Tieske Tieske merged commit 5de8fec into refactor/cli Jul 8, 2016
@Tieske Tieske deleted the fix/jwt_errorhandling branch July 8, 2016 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants