Skip to content

Conversation

@ustraria
Copy link
Contributor

@ustraria ustraria commented Jan 6, 2026

Issue #, if available:

Description of changes:

  • Added loginUsername support to CSV user import. This allows administrators to specify the OAuth provider username when bulk importing users for external OAuth setups

Changes:

  • Handler: Updated UserService.importUsers() to parse and store loginUsername from CSV
  • Handler: Updated getNewUserEntity() to accept loginUsername parameter
  • Handler: Added unit test assertions for loginUsername parsing
  • Web Client: Updated import help text to document the new loginUsername field

Why is this change necessary:
For external OAuth providers like AWS Cognito, userId is typically a UUID (sub claim) while loginUsername is the human-readable username. This change enables pre-provisioning users with their loginUsername via CSV import, which is useful for setting up user permissions before their first login.

How was this change tested:

  • Updated or added new unit tests.
  • Updated or added new integration tests.

Manually tested:

  • CSV import with loginUsername column (values populated and empty)
  • Verified backward compatibility with CSV files without loginUsername column
  • Verified loginUsername values stored correctly in DynamoDB

Any additional information or context required to review the change:

Documentation Checklist:

  • Updated the README if applicable. n/a updated import-users-constants.tsx which has instructions.
  • Updated the THIRD-PARTY-LICENSES file if applicable. n/a

Compatibility Checklist:

  • I confirm that the change is backwards compatible.
  • There is no modification of dependencies or if there is, a corresponding update to THIRD-PARTY-LICENSES is part of the commit.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Coverage Report

Component Lines Branches
dcv-access-console-handler 90.23% 79.62%
dcv-access-console-web-client 19.79% 9.68%
dcv-access-console-auth-server 58.39% 22.22%
dcv-access-console-configuration-wizard 6.27% 0.14%

@ustraria ustraria marked this pull request as ready for review January 6, 2026 16:19
CANCEL_BUTTON_TEXT: "Cancel",
IMPORT_USERS_HELP_TEXT: <div>Upload a CSV file with the following header:<br/><br/>
"userId","displayName","role","groups"<br/>
"userId","displayName","role","groups","loginUsername"<br/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add loginUsername after userId since it is semantically closer to userId?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, updated.

}

userRepository.save(getNewUserEntity(userId, displayName, role, false, null, false));
userRepository.save(getNewUserEntity(userId, null, displayName, role, false, null, false));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass userId as default loginUsername

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@ustraria ustraria force-pushed the wip/ustraria/import-users-login-username branch from 21c5e6e to a7a1adf Compare January 8, 2026 16:15
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

Coverage Report

Component Lines Branches
dcv-access-console-handler 90.23% 79.62%
dcv-access-console-web-client 19.79% 9.68%
dcv-access-console-auth-server 58.39% 22.22%
dcv-access-console-configuration-wizard 6.27% 0.14%

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loginUsername still at the end? Didn't we have to update the tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests were updated because of change where loginUsername defaults to userId instead of null. For the CSV parsing the column order doesn't matter due to the @CsvBindByName annotations, which map columns by header name , not by position.

continue;
}

String loginUsername = userId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we should add the validations similar to what you added for default groupIds for the importUsers values since they will also not be coming from the web client

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validations are not consistent between the values from importUsers and the claims. I don't think there is validation on loginUsername besides character length from claims or in importUsers. For groups in importUsers there is also not validation. We could add validation for groups for importUsers to match?

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