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

feat: Create new portal user from JWT request if one doesn't exist #1209

Merged
merged 6 commits into from
Feb 16, 2024

Conversation

abbyoung
Copy link
Contributor

@abbyoung abbyoung commented Feb 8, 2024

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

yarn 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

  • Met the acceptance criteria
  • Created new stories in Storybook if applicable
  • Created/modified automated unit tests in Jest
  • Created/modified automated E2E tests
  • Followed guidelines for zero-downtime deploys, if applicable
  • Use ANDI to check for basic a11y issues

As a reviewer, I have

Check out our How to review a pull request document.


Screenshots

Copy link

@abbyoung abbyoung marked this pull request as ready for review February 8, 2024 22:12
@abbyoung abbyoung requested a review from a team as a code owner February 8, 2024 22:12
}
// 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?
Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Contributor

@gidjin gidjin left a 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

}
// 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?
Copy link
Contributor

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?

@abbyoung abbyoung requested a review from gidjin February 16, 2024 20:31
@gidjin gidjin merged commit 7e0102c into main Feb 16, 2024
11 checks passed
@gidjin gidjin deleted the sc-3202-create-new-user-third-party-api branch February 16, 2024 22:12
gidjin pushed a commit that referenced this pull request Feb 22, 2024
## [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))
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