Skip to content

Affiliation Options for Sandbox API users : Ongoing Discussion Ticket #26378

Closed

Description

@vikas-gov

Background

There are challenges around how affiliations for API users will work compared to UI users. The main question is how to complete business affiliations using API to enable users in API sandbox to test and continue with their development.

Methods Discussed

  • Passcodes/Passwords: Used to authorize users, but not all businesses have one set up.
  • Access Codes: Issued for AR (Annual Report) filings but not tied to full business management. A new access code is generated every year for the AR filing.
  • Magic Links (Email-Based): Automated links sent to business emails for authorizing affiliation. It’s short-lived and lasts for 15-20 mins (to be confirmed)

Proposed Solutions

  • Passcode-Based Affiliation (Preferred Option):
    Use existing Passcode or Corporate Password for affiliation.
    If a passcode is missing, migrate the Access Code into the Passcode field.
  • Magic Link Automation (More Complex)
    Automate email parsing to extract the magic link.
    Risk: because anyone can request affiliation invitations.
  • Delegation Model
    Allow business owners to approve third-party access via UI.
    Not suitable for API users without manual steps.

Agreement

Perform testing in the sandbox for the following scenarios:

  • Affiliation using Passcodes

Challenges
As we started to look into testing in Sandbox, it was discovered, that in order to do the testing/validate the API affiliation scenario in Sandbox we are calling the auth api in prod.
On checking with Travis it was validated that they have a sandbox version ready to go but needs work/alignment on things like data sync from prod to sandbox.

Next Steps

  • Data sync for both Auth and Business Registry sandbox environments.
  • Configuration/Setup for Entities

Activity

  1. added
    Entities Team
    on Mar 6, 2025
  2. changed the title [-]Affiliation processes for API users[/-] [+]Affiliation Options for API users[/+] on Mar 6, 2025
  3. changed the title [-]Affiliation Options for API users[/-] [+]Affiliation Options for API users : Ongoing Discussion Ticket[/+] on Mar 10, 2025
  4. changed the title [-]Affiliation Options for API users : Ongoing Discussion Ticket[/-] [+]Affiliation Options for Sandbox API users : Ongoing Discussion Ticket[/+] on Mar 10, 2025
  5. bolyachevets commented on Mar 10, 2025

    @bolyachevets
    Collaborator

    recently i helped with moving a copy of lear db from openshfit to a "non-prod" lear db instance in gcp production environment. which database should this new 'sandbox' database mirror: 1. the 'non-prod' copy of lear db currently running in gcp prod 2. lear db in openshift prod 3. or some other database (e.g. the actual prod db that will be eventually running in gcp). i will have more questions depending on your answer

  6. bolyachevets commented on Mar 11, 2025

    @bolyachevets
    Collaborator

    also, i hope that daily syncing frequency is sufficient for your purposes

  7. argush3 commented on Mar 11, 2025

    @argush3
    Contributor

    @bolyachevets the OCP LEAR prod database should be the database we should be mirroring for sandbox. Once a day is good to start off with I think.

    Some other things we need to talk about:

    • We'll need to have some of the data obfuscated which I understand you have a way of doing already?
    • Are you able to also run other misc sql updates like bumping sequences etc?
  8. bolyachevets commented on Mar 11, 2025

    @bolyachevets
    Collaborator

    @argush3 To get data obfuscated, you'd need to provide a masking file and have anon extension installed in the db, here is an example: https://github.com/bcgov/sbc-auth/blob/main/jobs/gcp-db-data-masking/sql/mask.sql To establish these rules, you can either provide a list of columns you need to mask (then, i would create the mask.sql from the list), or make a mask.sql file yourself, or try managing masking rule via alembic, e.g. https://github.com/bcgov/STRR/pull/559/files (have not tried yet, but potentially this is the preferred way of doing it). If you provide an sql script with anything else you'd like to run (i.e. bumping sequences), that could be run as well. Potentially all these scripts would need to be stored in the lear repo. Just to be clear the process of syncing would be a a dump/restore (i.e. gcp export/import) On a side note lear db is running Postgres 12 which will be charged for extended support starting May 1, 2025. Not sure how long the plan is to keep running prod db in OpenShift for.

  9. bolyachevets commented on Mar 11, 2025

    @bolyachevets
    Collaborator

    N.B. don't run 'SELECT anon.anonymize_database();' against prod db, as it will permanently modify the data

  10. bolyachevets commented on Mar 13, 2025

    @bolyachevets
    Collaborator

    @argush3 lear-db-sandbox instance has been created. It currently has a copy of prod masked data.
    The data is refreshed via lear-db-ocp-sync job that uses another auxiliary copy of lear db running in gcp prod environment. Not sure how often you want to refresh entire db, as that would wipe out any data created by users interacting with sandbox environment. Thor mentioned that there is potentially a need to do partial data reloads from prod. If that is the case could we get some clarification about which tables/columns need to be reloaded.

  11. vikas-gov commented on Mar 13, 2025

    @vikas-gov
    CollaboratorAuthor

    @bolyachevets as discussed, lets have it on-demand for now. Will check with Thor on the scope of delta reloads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Entities Team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions