Skip to content

Hash client secrets and add admin client APIs - #3

Open
joneja09 wants to merge 1 commit into
cursor/local-sql-migrations-b700from
cursor/client-admin-secret-hashing-b700
Open

Hash client secrets and add admin client APIs#3
joneja09 wants to merge 1 commit into
cursor/local-sql-migrations-b700from
cursor/client-admin-secret-hashing-b700

Conversation

@joneja09

Copy link
Copy Markdown
Owner

Depends on #2.

Client secrets are no longer stored in plaintext, and you can register clients through an admin API instead of inserting rows by hand.

Secret hashing

  • Secrets are hashed with ASP.NET Identity's PasswordHasher
  • Token endpoint verifies the hash (plaintext leftovers from an older database are still accepted once, then re-hashed on seed)
  • Admin responses never return the stored hash; the plaintext secret is shown only at create/rotate time

Admin API (Administrator role)

Sign in as the seeded admin@localhost user, then:

  • GET /admin/clients
  • POST /admin/clients — returns the secret once
  • PUT /admin/clients/{id}
  • POST /admin/clients/{id}/secret — rotate
  • DELETE /admin/clients/{id}

JWTs from /account/login/token now include role claims so [Authorize(Roles = "Administrator")] works.

Tests

dotnet test: 12 passed.

Open in Web Open in Cursor 

Store client secrets with ASP.NET Identity's password hasher, include Administrator roles on JWTs, and add /admin/clients CRUD plus secret rotation so apps can be registered without writing SQL.

Co-authored-by: Jeff Jones <joneja09@users.noreply.github.com>
@joneja09
joneja09 marked this pull request as ready for review August 26, 2026 14:23
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