-
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
feat: Create new portal user from JWT request if one doesn't exist #1209
Conversation
This pull request has been linked to Shortcut Story #3202: Third-Party API: Create auth'd user in portal if none exists. |
src/pages/api/thirdparty/graphql.tsx
Outdated
} | ||
// Q: Should we include last login? They are technically | ||
// not logging in to the portal. Do we want to use it to track | ||
// API access as well? |
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.
Question here for @gidjin @jcbcapps @jbecker01 -- do we want to track lastLogIn
field for a user created via third-party API?
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 can go either way on that. I can see both sides. Maybe we leave it off 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.
lgtm, once we fix the user creation issue I'm happy to approve
src/pages/api/thirdparty/graphql.tsx
Outdated
} | ||
// Q: Should we include last login? They are technically | ||
// not logging in to the portal. Do we want to use it to track | ||
// API access as well? |
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 can go either way on that. I can see both sides. Maybe we leave it off for now?
## [4.31.0](4.30.1...4.31.0) (2024-02-22) ### Features * Add additional content to third-party API ([#1206](#1206)) ([053cd1d](053cd1d)) * Add Site Header ([#1210](#1210)) ([4f34bc4](4f34bc4)) * Create new portal user from JWT request if one doesn't exist ([#1209](#1209)) ([7e0102c](7e0102c)) * Support additional file types for opening docs in browser ([#1214](#1214)) ([0c67389](0c67389)) ### Bug Fixes * a11y: Guardian Directory field labeling ([#1205](#1205)) ([db3df68](db3df68)) * a11y: edit display name component syntax ([#1204](#1204)) ([c6408cf](c6408cf)) * a11y: move skip link anchor entry point to unique page content in default layout ([#1212](#1212)) ([c2e8e8e](c2e8e8e)) * adds page title to Guardian Directory page ([#1211](#1211)) ([8f0b0cb](8f0b0cb))
SC-3202
Proposed changes
If a valid JWT is passed to the third-party API and the user doesn't exist in the portal db (meaning they have never logged in), we now create a new portal user in mongodb.
Because we don't get their full name in the token. I'm setting the displayName to their CN. If/when they log in to the portal it can easily be updated.
Reviewer notes
e2e branch: sc-3202-create-new-user-third-party-api
Setup
Start the system
yarn services:up yarn dev cd ../ussf-portal-cms yarn dev
Login to the portal http://localhost:3000
Start storybook
Login to storybook http://localhost:6006, though the command above should open it for you
Code review steps
As the original developer, I have
As a reviewer, I have
Check out our How to review a pull request document.
Screenshots