-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add fulfill route and tests #280
Conversation
except jwt.exceptions.ExpiredSignatureError: | ||
statusCode = 401 | ||
responseBody = 'Expired access token' | ||
except (jwt.exceptions.DecodeError, UnicodeDecodeError, IndexError, AttributeError): | ||
statusCode = 401 | ||
responseBody = 'Invalid access token' | ||
except ValueError: | ||
logger.warning("Could not deserialize NYPL-issued public key") | ||
statusCode = 500 | ||
responseBody = 'Server error' |
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.
Good to catch all these exception cases
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA44ilHg/PxcJYsISHMRyoxsmez178qZpkJVXg7rOMVTLZuf05an7Pl+lX4nw/rqcvGQDXyrimciLgLkWu00xhm6h6klTeJSNq2DgseF8OMw2olfuBKq1NBQ/vC8U0l5NJu34oSN4/iipgpovqAHHBGV4zDt0EWSXE5xpnBWi+w1NMAX/muB2QRfRxkkhueDkAmwKvz5MXJPay7FB/WRjf+7r2EN78x5iQKyCw0tpEZ5hpBX831SEnVULCnpFOcJWMPLdg0Ff6tBmgDxKQBVFIQ9RrzMLTqxKnVVn2+hVpk4F/8tMsGCdd4s/AJqEQBy5lsq7ji1B63XYqi5fc1SnJEQIDAQAB | ||
-----END PUBLIC KEY----- |
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.
This is a good addition to the sample compose file for the local environment.
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.
The new endpoint looks really good. The logic in the blueprint is fine since some of the other blueprints have a lot of logic as well when calling methods. I would only recommend finishing the rest of the tests you want to implement before fully merging this branch into main.
I'm going to go ahead and merge this, and add the one test I think I'm missing (need to mock an exception thrown for an expired token) with my next PR so that it can be reviewed. |
Does not have 100% test coverage; when everything is hooked up I will add test cases for the positive cases of "yes, this is working" and also figure out how to mock the expired token.
Don't love how much logic lives directly in the Blueprint but given the error structure I'm not sure how to best test it if I were to bundle the auth logic in another file, but open to refactoring.