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

78001 - Representative User validation #16084

Closed
wants to merge 17 commits into from
Closed

Conversation

bramleyjl
Copy link
Contributor

@bramleyjl bramleyjl commented Mar 25, 2024

Summary

  • Updates AccreditedRepresentativePortal::RepresentativeUserLoader to validate Veteran::Service::Representative record
  • Validation based on first_name, last_name, ssn, birth_date - dob & birth_date sourced from an MPI call using ICN
  • If no record is found authentication will be blocked with a RecordNotFoundError

Related issue(s)

Testing done

  • New code is covered by unit tests
  • To test, you will need to create a Veteran::Service::Representative with the attributes of the test user you have chosen:
attributes = {
  first_name: 'GREG',
  last_name: 'ANDERSON',
  ssn: '796121200',
  dob: '1933-04-05',
  representative_id: '12345',
  poa_codes: ['TEST']
}
Veteran::Service::Representative.new(attributes).save!
  • The above example uses the information from [email protected]
  • You should then be able to perform representative authentications to test the validation with your chosen user (successful auth) and other users (failed auth).

Logs

Rails -- User is not a VA representative : {:access_token_authorization_header=><access_token>}

Acceptance criteria

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Feature/bug has a monitor built into Datadog or Grafana (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected
  • I added a screenshot of the developed feature

@bramleyjl bramleyjl changed the title 78001 - Representative User Authentication 78001 - Representative User validation Mar 26, 2024
@bramleyjl bramleyjl force-pushed the 78001_rep_validator branch from 7ec4060 to 6897db9 Compare March 26, 2024 17:02
@bramleyjl bramleyjl marked this pull request as ready for review March 26, 2024 17:03
@bramleyjl bramleyjl requested a review from a team as a code owner March 26, 2024 17:03
Comment on lines 115 to 117
handle_error('User is not a VA representative',
Constants::ErrorCode::GENERIC_EXTERNAL_ISSUE,
error: Errors::RepresentativeRecordNotFoundError)
Copy link
Contributor

Choose a reason for hiding this comment

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

😎

@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main March 26, 2024 17:39 Inactive
@bramleyjl bramleyjl force-pushed the 78001_rep_validator branch from ef89607 to ab5dcd5 Compare March 26, 2024 21:29
@bramleyjl bramleyjl requested review from a team as code owners March 26, 2024 21:29
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main March 26, 2024 21:43 Inactive
@bramleyjl bramleyjl force-pushed the 78001_rep_validator branch from ab5dcd5 to 825dfef Compare March 27, 2024 20:42
@bramleyjl bramleyjl requested review from a team as code owners March 27, 2024 20:42
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main March 27, 2024 21:22 Inactive
@gabezurita gabezurita self-requested a review March 28, 2024 18:59
@bramleyjl bramleyjl force-pushed the 78001_rep_validator branch from 825dfef to 95761e4 Compare April 1, 2024 14:52
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 1, 2024 15:11 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 1, 2024 16:41 Inactive
@bramleyjl bramleyjl force-pushed the 78001_rep_validator branch from 2332822 to 44011a0 Compare April 1, 2024 21:34
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 1, 2024 21:53 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 1, 2024 23:44 Inactive
@bramleyjl bramleyjl force-pushed the 78001_rep_validator branch from 2b8051c to 24468b2 Compare April 2, 2024 17:02
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 2, 2024 17:04 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 2, 2024 18:12 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 2, 2024 18:18 Inactive
@bramleyjl bramleyjl force-pushed the 78001_rep_validator branch from 7e5270f to a57bfd2 Compare April 2, 2024 19:11
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 2, 2024 19:12 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 2, 2024 19:18 Inactive
@bramleyjl bramleyjl force-pushed the 78001_rep_validator branch from 6354edc to 0910c23 Compare April 2, 2024 22:54
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 2, 2024 22:55 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 2, 2024 23:01 Inactive
@bramleyjl bramleyjl requested a review from rileyanderson April 2, 2024 23:04
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 3, 2024 16:15 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to 78001_rep_validator/main/main April 3, 2024 17:35 Inactive
representative = Veteran::Service::Representative.for_user(first_name: session.user_attributes_hash['first_name'],
last_name: session.user_attributes_hash['last_name'],
ssn: mpi_profile.ssn,
dob: mpi_profile.birth_date)
Copy link
Contributor

@gabezurita gabezurita Apr 3, 2024

Choose a reason for hiding this comment

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

The ARP engine will likely use a VS::Representative's OGC number to get their POA codes, which is currently stored in vets-api's representative_id. This will not be used for validation, but to get the poa_codes associated with a Representative.

See this Zenhub issue exploring ARP engine RepresentativeUser validation/authentication. Summary below.

RepresentativeUser Authentication/Validation Exploration Summary

Interim, Pilot Solution

@amprokop, @nihil2501, and I explored the hypotheses outlined in the above issue. The most feasible pilot alternative seems to be to add an enabled: bool attribute to the RepresentativeUser model, with ARF engineers setting this in a static JSON file within vets-api. This would be a whitelisting approach.

Other Explored Alternatives

  • Is there a private OGC registration number that is treated as a secret?
    • Per the OGC API's v1/accreditations/Representatives/{id} endpoint, there are two returned IDs (in UUID format), repVSoid and accrRepId, that could potentially be used for this. ARF is unsure if these OGC API IDs are treated as a secret or are IDs meant for internal use, and OGC<>ARF coordination will be necessary around that. Even then, thought would need to be given to how ARF would get these identifiers to Representatives. Additionally, given that these identifiers are in UUID format, it would be cumbersome for VSReps to enter them manually in ARP.
  • Could ARP require users to perform one-time authentication using the email address OGC already has on file? (this will probably block some users from access, as ARM found data quality issues with rep contact data, but it may be a sound long-term incentive to keep that data correct?)
    • This is possible, but it may be a heavy lift for the ARP Pilot. Additionally, there would be friction to this alternative, given OGC data quality issues around emails.
  • Could we match on SSN, DOB first name, and last name and have that be enough? (SSN is found in OGC's internal dataset, though we need to verify how reliably it is present)
    • The OGC API's/api/v1/accreditations/Representatives/active endpoint returns DOB and SSN as fields in the response body, but all values are currently empty. The ARF Team would have to check with OGC if they plan on returning populated DOBs and SSNs in their responses. This is a promising alternative if OGC plans to return non-nil values for DOB and SSN.

Copy link
Contributor

Choose a reason for hiding this comment

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

@bosawt, what are your thoughts on pushing forward with the above interim solution for the ARP pilot?

current_user
end

def validate_account_and_session
raise SignIn::Errors::SessionNotFoundError.new message: 'Invalid Session Handle' unless session
end

def validate_representative_status
mpi_profile = mpi_service.find_profile_by_identifier(identifier: session.user_account.icn,
Copy link
Contributor

@gabezurita gabezurita Apr 9, 2024

Choose a reason for hiding this comment

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

ARP will use session.user_verification and have a join table between UserVerification (credential someone logged in as) <> VS::Representative, which will get used to set a RepresentativeUser's poa_codes here.

Copy link

github-actions bot commented May 9, 2024

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label May 9, 2024
Copy link

This PR has been closed because it has had no activity for 37 days

@github-actions github-actions bot closed this May 16, 2024
@github-actions github-actions bot deleted the 78001_rep_validator branch May 16, 2024 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants