Skip to content

Support basic u13 SSO flow via RPF for Ada - #823

Open
jacbn wants to merge 6 commits into
mainfrom
feature/ada-u13-rpf-sso
Open

Support basic u13 SSO flow via RPF for Ada#823
jacbn wants to merge 6 commits into
mainfrom
feature/ada-u13-rpf-sso

Conversation

@jacbn

@jacbn jacbn commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Allows the RPF SSO flow to correctly manage u13 users. These users do not have a (valid, string-typed) name or nickname field; instead, they use the username field. For these users, we create an account with a blank given name and the last name set to their username. It should be noted that these accounts can be detected via their email address, which is always dummy@example.com.

Since u13 users do not have a valid email address we can tie to their account, this PR creates a new EmailVerificationStatus, EmailVerificationStatus.AGE_RESTRICTED. This is intended to circumvent issues with reusing any of the other verification statuses, which would imply issues (or non-issues) with the account that are not genuine. This also acts as an indicator in the user object for whether the account is under 13 or not, which we make use of in the front-end. A downside to this approach is that we will need a Quartz job to run once a month to update all AGE_RESTRICTED users who have had their 13th birthday in that month (we do not store the day of the DoB for u13) to DELIVERY_FAILED; while not perfect, this highlights that they cannot receive important communications from us without an email and they should add one to their account.

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 3.03030% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.67%. Comparing base (d9c5d5a) to head (0a65786).
⚠️ Report is 45 commits behind head on main.

Files with missing lines Patch % Lines
...l/dtg/segue/auth/RaspberryPiOidcAuthenticator.java 0.00% 17 Missing ⚠️
.../cl/dtg/segue/api/managers/UserAccountManager.java 0.00% 8 Missing and 2 partials ⚠️
...java/uk/ac/cam/cl/dtg/segue/comm/EmailManager.java 0.00% 2 Missing and 1 partial ⚠️
.../segue/auth/exceptions/AgeRestrictedException.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #823      +/-   ##
==========================================
+ Coverage   41.00%   41.67%   +0.66%     
==========================================
  Files         550      551       +1     
  Lines       23602    23693      +91     
  Branches     2848     2869      +21     
==========================================
+ Hits         9678     9874     +196     
+ Misses      13052    12923     -129     
- Partials      872      896      +24     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

} else {
if (existingUser.getEmailVerificationStatus() == EmailVerificationStatus.AGE_RESTRICTED
&& updatedUser.getDateOfBirth().before(DateUtils.addYears(new Date(), -13))) {
userToSave.setEmailVerificationStatus(EmailVerificationStatus.DELIVERY_FAILED);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't a big deal if the Quartz job you mention is reliable and carried out right at the start/end of each month, but as-is I'm finding it quite confusing when this transition happens after saving on the Account page.
The save occurs just fine, but in the same instance a new field appears with a quite a glaring error beneath it - which makes it feel like the save did not occur.

If we think there's a reasonable chance that a user could see this behaviour, it ought to be better explained. Maybe we should detect in the front-end when a switch from AGE_RESTRICTED to DELIVERY_FAILED has happened and explain it in a modal (or something)?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also on this topic: you talk about needing a Quarts job in the PR description, but there isn't one actually included in the PR. Is there a plan about doing that later?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I discussed this with James who believes the model of being able to update an AGE_RESTRICTED account, ever, isn't what we should be going for. That is, u13 accounts are to be entirely separate from non-u13 accounts, and a user will need to make a new account to update it. We might change this in the future, but it "isn't a problem we should solve now".

I've undone the changes here but will copy your comments into a new card.

@jacbn
jacbn marked this pull request as ready for review August 26, 2026 11:29

@sjd210 sjd210 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm happy with this. I definitely think it's easier and safer to introduce the accounts with no explicit way of upgrading them to o13 - as long as we do discuss a mechanism for doing this upgrade eventually (once we're a little less pressed for time) ((I've seen that there's a card)) 👍

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