-
Notifications
You must be signed in to change notification settings - Fork 2
Set up user identity and JWT for native users #84
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
Conversation
- Import `user_identity` auth, `user` router, and `user_record` util, and associated tests from last year's HackAtUCI/HackUCI-Site - Install python-jose[cryptography] - Add user router to app
- Ignore call-arg error when calling super constructor - `EmailStr` no longer needs to be explicitly constructed
- Replace `dict` with `model_dump` and `parse_obj` with `model_validate`
- Provide user identity cookie when authenticating with SAML ACS - Rename `hackuci_auth` to `irvinehacks_auth`
- Use `Annotated` for `Cookie` and `Union` instead of `Optional`
- `Optional` fields are no longer not required in Pydantic V2 models - Add unit test for `/user/me` endpoint
Deploy preview for irvinehacks-site-2024-sanity ready!
|
Deploy preview for irvinehacks-site-2024 ready!
|
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 work on this! Thankfully, stubs exist for python-jose
already.
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.
A few nitpicks addressed above:
- Add `pydantic.mypy` plugin to generate signature for `Model.__init__` - Do not enable `init_forbid_extra` option - This will type `super().__init__` with an extra `kwargs: Any` - Thus the type ignore in `NativeUser` can be removed
Please squash merge. |
Include the user identity code from last year to provide JWTs when completing SAML authentication.
The full guest authentication flow will come separately with #68, but the user identity foundation is provided here, e.g. the
GuestUser
model.Closes #69.
Changes
user_identity
auth,user
router, anduser_record
util, and associated tests from last year's HackAtUCI/HackUCI-SiteJWT_SECRET
check toindex.py
NativeUser
,EmailStr
EmailStr
no longer needs to be explicitly constructeddict
withmodel_dump
andparse_obj
withmodel_validate
hackuci_auth
toirvinehacks_auth
Annotated
forCookie
andUnion
instead ofOptional
IdentityResponse
for userOptional
fields are no longer not required in Pydantic V2 models/user/me
endpointJWT_KEY
log_out
tologout
for consistencyTesting
Staging subdomain was manually assigned to the preview deployment. Confirmed SAML flow works and user identity cookie is provided which is properly consumed by
/api/user/me
endpoint.