-
Notifications
You must be signed in to change notification settings - Fork 55
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
Fetch OrganizationRoleClaims from DB when feature flag enabled #8030
Conversation
3938acf
to
7bea9fb
Compare
7bea9fb
to
d5ba960
Compare
OrganizationRoleClaims claims = optClaims.orElseThrow(UnidentifiedUserException::new); | ||
|
||
// use the target user's org so response is built correctly even if site admin is the requester | ||
Organization org = _orgService.getOrganization(claims.getOrganizationExternalId()); |
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.
lines 732-743
unnecessary because we can get OrganizationRoles
from the OrganizationRoleClaims
using this OrganizationService
method.
* @param dbClaims - List<OrganizationRoleClaims> from DB | ||
* @return boolean | ||
*/ | ||
public boolean checkOrgRoleClaimsEquality( |
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.
...ain/java/gov/cdc/usds/simplereport/config/authorization/DemoAuthenticationConfiguration.java
Outdated
Show resolved
Hide resolved
backend/src/main/java/gov/cdc/usds/simplereport/service/ApiUserService.java
Show resolved
Hide resolved
backend/src/main/java/gov/cdc/usds/simplereport/service/ApiUserService.java
Show resolved
Hide resolved
backend/src/main/java/gov/cdc/usds/simplereport/service/ApiUserService.java
Outdated
Show resolved
Hide resolved
backend/src/main/java/gov/cdc/usds/simplereport/service/ApiUserService.java
Outdated
Show resolved
Hide resolved
backend/src/main/java/gov/cdc/usds/simplereport/service/DbOrgRoleClaimsService.java
Show resolved
Hide resolved
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.
great to see this started elisa! left some initial questions for you
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.
Tested in dev2 and dev3 and things look good overall! Great job with all this migration work!
Quality Gate passedIssues Measures |
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.
thanks so much for your hard work on this elisa!
backend/src/main/java/gov/cdc/usds/simplereport/service/ApiUserService.java
Show resolved
Hide resolved
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.
thank you for all your hard work on this! it's so cool to see this coming together 🤩
do you think we need to use the db roles for this permission check too?
https://github.com/CDCgov/prime-simplereport/blob/refs/heads/elisa/7598-read-roles-from-db/backend/src/main/java/gov/cdc/usds/simplereport/config/authorization/UserAuthorizationVerifier.java#L100
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 just a thought, not feedback - I haven't looked at all the usages of OrganizationRoleClaims
but do you think we'll be able to clean that up as a concept entirely once the migration is complete? it seems like we mostly use it to hold the values of org, facilities, roles that we've pulled from the Okta groups before we can convert them into their objects.
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.
Yes, I think you are right! Once fully migrated, we will be able to clean it up!! 😮💨 🧹 🤩
forgive me if these are included in the remaining work you called out, but I noticed a couple unexpected places where we're using Okta groups as source of truth:
|
I didn't explicitly call these out but I was going to search the entire repo for where we were calling the |
ohhhh nice catch! I will update this 😅 Thank you!!! 🙌 🐛 🔍 |
oh nice that should definitely do it. everything looks good! the permission check update could totally go in a follow-up PR too if you want to just merge this |
I'll fix the permission check in a separate PR 🙏 Thank you for your flexibility. |
Going to merge this in after demo 💪 |
BACKEND PULL REQUEST
Related Issue
Changes Proposed
DbOrgRoleClaimsService
ApiUser
s role and facility information toOrganizationRoleClaims
and returning those claimsOrganizationRoleClaims
from Okta and the DB and log if there is an errorconsolidateUser
method inApiUserService
Additional Information
Testing
Envs
oktaMigrationEnabled
FALSE on dev2oktaMigrationEnabled
TRUE on dev3Some scenarios to try in both environments:
MisconfiguredUserException
being thrown:I think this makes sense if we are only enabling this flag after all users have been migrated over. Once the other work goes in, this user wouldn't be appear in the "Manage users" page so this error wouldn't be visible to end-users.