Skip to content

Deep clean: stop reading password hash, fail-fast config, dependency hygiene - #5

Merged
Isma-L154 merged 6 commits into
mainfrom
refactor/english-rewrite-v2
Sep 22, 2026
Merged

Isma-L154 merged 6 commits into
mainfrom
refactor/english-rewrite-v2

Conversation

@Isma-L154

Copy link
Copy Markdown
Owner

Closes #3

Brings the cleanup reviewed and merged in #4 into main.

Changes

  • Security: the password hash is no longer read into memory or exposed on the public User model. The reflection mapper package Authorization.Common is replaced with explicit mapping, and the entities are now internal to DataAccess.
  • Dependencies: the middleware uses the Microsoft.AspNetCore.App framework reference instead of the legacy Microsoft.AspNetCore.Http.Abstractions 2.3.0 package and redundant Microsoft.Extensions.* references.
  • Resilience: configuration is validated at startup (ValidateOnStart) instead of failing every request.
  • Quality: added a UserIdClaimType constant, removed stale comments, updated the README and tests, and restricted CI token permissions.

Breaking changes (v2.0.0)

  • The Authorization.Common package was removed.
  • Abstractions.Entities is no longer public.
  • User.PasswordHash was removed.
  • Invalid configuration now fails host startup.

Release note

Merging publishes the 2.0.0 packages to GitHub Packages through release.yml.

…icit mapping

The reflection-based mapper in Authorization.Common copied every matching
property from the database entity into the domain model, which carried the
user's password hash into the business and middleware layers even though
nothing there needs it. The package only ever mapped two trivial types.

- Remove Authorization.Common (Mapper, Converter) and their tests.
- Move persistence entities into DataAccess as internal types without a
  password hash property; Dapper ignores the unmatched column.
- Remove PasswordHash from the public User model.
- Map entities to models explicitly in SecurityRepository.

Refs #3
Microsoft.AspNetCore.Http.Abstractions 2.3.0 is the legacy ASP.NET Core 2.x
package; on net8.0 it ships its own copies of types that the host already
provides through the shared framework. Reference Microsoft.AspNetCore.App
instead, which also covers the Microsoft.Extensions.* packages that were
listed explicitly (Configuration.Abstractions was unused).

Refs #3
SqlConnectionFactory throws when the connection string is missing, but it is
resolved while binding the middleware's scoped dependencies, outside the
middleware's graceful-degradation block. A misconfigured host therefore
returned 500 on every authenticated request. Validate the options and the
connection string presence with ValidateOnStart so the host fails fast.

Refs #3
- Add ClaimsEnrichmentMiddleware.UserIdClaimType so consumers and tests stop
  repeating the "IdUsuario" literal.
- Make AddProfileClaimsAsync static; it uses no instance state.
- Drop historical wording from option docs and package descriptions.
- Update the README for the removed Common package and startup validation.
- Share middleware construction in tests and cover the aborted-request path.

Refs #3
An empty branches-ignore list is equivalent to an unfiltered push trigger.
The CI job only needs to read the repository, so grant contents: read.

Refs #3
Deep clean: stop reading password hash, fail-fast config, dependency hygiene
@Isma-L154
Isma-L154 merged commit 1397456 into main Sep 22, 2026
3 checks passed
@Isma-L154
Isma-L154 deleted the refactor/english-rewrite-v2 branch September 22, 2026 04:24
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.

Deep clean: dependency hygiene, PII leak, fail-fast config, remove reflection mapper

1 participant