-
Notifications
You must be signed in to change notification settings - Fork 119
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
PASETO: Replace Payload struct by paseto.JSONToken + Improve helpers and public errors #5
Conversation
- All errors are now public - Improve default ErrorHandler error verification - Add ContextKey and TokenLookup configs to DefaultConfig
- fix Config struct comment
I've update in another branch to replace the Payload struct and utilize the |
here is the right place for the tests that are important for your customization, since the pull request is not closed yet, you should add them here |
@ReneWerner87 I think it's done now. Also, I'm thinking on use Of course, do this in another PR, cause is a big change |
@Jictyvoo hmm, you said you are through, however i don't see any new testcases for the errors ? can you please include a test for these different errors where you check the correct misbehavior some should already exist, some not yet ErrExpiredToken = errors.New("token has expired")
ErrMissingToken = errors.New("missing PASETO token")
ErrDataUnmarshal = errors.New("can't unmarshal token data to Payload type")
fiber.StatusBadRequest |
- Create private function defaultErrorHandler - Create `PayloadCreator` function type - Add docs to some function types - Add doccomment to NewPayload
- Create - Test_PASETO_MissingToken - Test_PASETO_ErrDataUnmarshal - Test_PASETO_ErrTokenExpired - Test_Config_Invalid_SymmetricKey
Added some tests to cover that. But to do that I detach the defaultErrorHandler to be a const function instead of a anonymous function Also, what you think about the change of |
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.
Thx
sorry forgot to answer your question
is currently okay for me, if we get problems with it, we can still change it, software grows as you use it |
No problem. Now I gonna think if it's good to add a Storage parameter to the middleware to stores token/uuid to add a verification to it |
As requested in #4 this PR improve some things about config and move all errors to helpers.go
More additions
Payload
struct bypaseto.JSONToken
structConfigDefault
values when a given config is empty, to be more consistent withConfigDefault