Skip to content

feat(nav): make filing button in main nav auth-aware#2758

Merged
contolini merged 5 commits into
masterfrom
5535-filing-nav
May 19, 2026
Merged

feat(nav): make filing button in main nav auth-aware#2758
contolini merged 5 commits into
masterfrom
5535-filing-nav

Conversation

@contolini
Copy link
Copy Markdown
Member

@contolini contolini commented May 6, 2026

When a user visits /filing, check their auth state and send them to either the filing "home" screen (the login page) or the institutions screen that lists their institutions.

This logic was already in the app but was incomplete. Currently, HomeContainer.jsx checks the app's state for the presence of an open ID connect value, which would indicate that the user has authenticated. The user is sent to the login screen if that oidc value is null. However, it's always null because there's no code anywhere in the codebase that defines it. There's a USER_FOUND action type that defines it but it's not used anywhere. This PR dispatches that action at the appropriate times and includes the user's keycloak info as the payload.

Changes

  • Dispatch USER_FOUND (via userFound action creator) when the filing app checks for keycloak.authenticated and it's true.
  • Dispatch USER_SIGNED_OUT (via userSignedOut action creator) when authentication is not found by the filing app.
  • In the HomeContainer component is the user's oidc property set?
    • No? Render the home component (this is the login page with the login.gov button).
    • Yes? Render the institutions component.
  • Replace the logo anchor link with a <Link> to keep the entire nav within react router.

Testing

  1. e2e tests should pass.
  2. When you click Filing and you're not logged in, does it show the login.gov page? After logging in, try clicking around the site and then clicking the Filing nav item. Does it take you directly to your institutions screen?

Notes

  • Redux's state is stored in memory so if you leave the app (e.g. by clicking over to the documentation site or refreshing the page), the oidc value will be cleared and the user will have to click the login.gov button again when visiting the filing page.

@contolini contolini requested a review from billhimmelsbach May 6, 2026 15:30
link.href = `/filing/${config.defaultDocsPeriod}/`
return link
})
} No newline at end of file
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The Filing link in the main nav uses this helper function to set its href to /filing/<current-filing-period>. It's unnecessary because our router redirects /filing to the current filing period so it's much cleaner to just have the nav link to /filing.

Copy link
Copy Markdown
Contributor

@billhimmelsbach billhimmelsbach left a comment

Choose a reason for hiding this comment

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

Looking great!

HMDA's sign out flow is weird, and maybe we should just get rid of this whole confirmation page anyway and go straight to login.gov, but it does have this weird "Filing Home" link that still exhibits the old behavior?

Image

contolini added 3 commits May 13, 2026 14:16
Check the user's auth state and if they're logged in, send them
to the institutions screen.
id_token_hint was replaced with client_id in #2322
for unknown reasons. Reverting this change causes the "Logout" button in the
filing app header to take the user directly to the login.gov logout screen
instead of an unnecessary keycloak interstitial page.
@contolini
Copy link
Copy Markdown
Member Author

Looking great!

HMDA's sign out flow is weird, and maybe we should just get rid of this whole confirmation page anyway and go straight to login.gov, but it does have this weird "Filing Home" link that still exhibits the old behavior?

@billhimmelsbach I removed this interstitial page via 577c636 per our chat.

@contolini contolini enabled auto-merge May 14, 2026 04:38
Copy link
Copy Markdown
Contributor

@billhimmelsbach billhimmelsbach left a comment

Choose a reason for hiding this comment

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

Heyo! It's looking good, but there might be a bug here that causes some issues?

When you call store.dispatch in refresh() and forceRefreshToken(), store is actually not defined in that function's scope. The other functions that call it use getStore() first to access it. So if you're logged into the filing app and one of these functions triggers: it'll error, hit the catch block with login(), and then bring ya back to the filing home.

You can test it out by idling on the profile page for awhile (refresh()), or by updating your profile (forceRefreshToken()). You'll see ReferenceError: store is not defined in the console then be taken back to the filing home. I put in some code suggestions where I'd put the getStore() in.

Comment thread src/filing/utils/keycloak.js
Comment thread src/filing/utils/keycloak.js
contolini and others added 2 commits May 18, 2026 12:38
Co-authored-by: Bill Himmelsbach <whimmels@gmail.com>
Co-authored-by: Bill Himmelsbach <whimmels@gmail.com>
@contolini
Copy link
Copy Markdown
Member Author

You can test it out by idling on the profile page for awhile (refresh()), or by updating your profile (forceRefreshToken()). You'll see ReferenceError: store is not defined in the console then be taken back to the filing home. I put in some code suggestions where I'd put the getStore() in.

Yuuuuup nice catch! Accepting your code suggestions fixes things. Thanks!

@contolini contolini requested a review from billhimmelsbach May 18, 2026 19:46
Copy link
Copy Markdown
Contributor

@billhimmelsbach billhimmelsbach left a comment

Choose a reason for hiding this comment

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

Looks good now! Thanks for the work on it!

@contolini contolini merged commit 71cf226 into master May 19, 2026
1 check passed
@contolini contolini deleted the 5535-filing-nav branch May 19, 2026 21:11
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