#523 - Decompose auth middleware responsibilities

Open
#527 0 comments 0 reactions 1 assignee View on GitHub

@brijesh-amin is already working on this.

Since Jul 17, 2026.

Assessment

This issue has not been assessed yet.

Description

Parent: #523

Objective

Split authentication middleware into focused units to improve maintainability and reduce bootstrap/runtime risk.

In scope

  • Separate JWT validation, user lookup/sync, role mapping, and permission resolution into composable functions
  • Remove hard process termination from auth initialization path
  • Keep existing auth outcomes and role assignment behavior

Acceptance criteria

  • authmware orchestration delegates to smaller testable functions/modules
  • Initialization failures propagate through startup error handling instead of process.exit in middleware
  • Existing auth behavior remains compatible for idir/bceid role mapping
  • Unit tests added/updated for extracted units

Notes

Prioritize readability and explicit error semantics over broad functional changes.

Dominant language
TypeScript
Stars
1
Forks
7
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bcgov/range-api

All issues in bcgov/range-api

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.