Skip to content

feat(self-hosted-auth): self-hosted username/password identity provider - #5367

Closed
adrians5j wants to merge 1 commit into
nextfrom
adrian/db-auth-2026-07-03
Closed

feat(self-hosted-auth): self-hosted username/password identity provider#5367
adrians5j wants to merge 1 commit into
nextfrom
adrian/db-auth-2026-07-03

Conversation

@adrians5j

@adrians5j adrians5j commented Jul 3, 2026

Copy link
Copy Markdown
Member

What changed

Adds a self-hosted username/password identity provider for the pure-Node (-server) flavour of Webiny — a first-party alternative to Cognito/Auth0 that needs no external auth service.

It plugs into Webiny's existing IdP interface exactly like Cognito does: it registers a JwtIdentityProvider that recognises and verifies its own tokens (matching on the webiny-self-hosted issuer), so it coexists with any other provider with zero core changes. The half that Cognito delegates to an external service — issuing tokens — is implemented here as a public selfHostedAuthLogin(email, password) GraphQL mutation that verifies the credential and mints a signed JWT.

Two packages, mirroring the cognito/auth0 sibling pattern:

  • @webiny/self-hosted-auth — database-agnostic auth logic:
    • scrypt password hashing via node:crypto (zero native dependencies). Hashes are self-describing (scrypt$N$r$p$salt$hash), so a future Argon2id hasher can be dropped in without a migration.
    • HS256 JWT issue/verify (jsonwebtoken), with the signing secret injected via config or WEBINY_SELF_HOSTED_AUTH_SECRET.
    • LoginUseCase, SetPasswordUseCase, and a UserInstaller that seeds the first admin (creates the user via api-core, then sets its password, with rollback on failure).
    • A CredentialsStorageOperations seam so credential storage stays pluggable per database.
  • @webiny/self-hosted-auth-sql — the thin Knex implementation of CredentialsStorageOperations, following the repo's existing storage-ops pattern (lazy table ensure, JSON data column). Credentials live in their own table, never on the admin-user record.

Security niceties: login returns a single generic error and runs a dummy hash on missing accounts to keep timing roughly constant, mitigating user enumeration.

Scope / follow-ups (not in this PR): no automated tests yet; no Mongo (-mdb) storage package yet; no admin-side login UI; and SetPasswordUseCase carries a TODO(authz) for self-service-vs-admin-reset enforcement. There is also a v0 tenancy decision (credentials resolved by email alone) documented in LoginUseCase.

Changelog

Self-hosted username & password login

Webiny can now run with its own built-in username-and-password sign-in, so a self-hosted deployment no longer needs an external login service. Administrators get a first account set up automatically during installation.

Squash merge commit

feat(self-hosted-auth): add username/password identity provider (#5367)
feat(self-hosted-auth): self-hosted auth with scrypt + JWT (#5367)

@adrians5j adrians5j added this to the 6.6.0 milestone Jul 3, 2026
@adrians5j adrians5j changed the title adrian/db-auth-2026-07-03 feat(self-hosted-auth): self-hosted username/password identity provider Jul 3, 2026
@adrians5j adrians5j closed this Jul 6, 2026
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.

1 participant