feat(self-hosted-auth): self-hosted username/password identity provider - #5367
Closed
adrians5j wants to merge 1 commit into
Closed
feat(self-hosted-auth): self-hosted username/password identity provider#5367adrians5j wants to merge 1 commit into
adrians5j wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
JwtIdentityProviderthat recognises and verifies its own tokens (matching on thewebiny-self-hostedissuer), 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 publicselfHostedAuthLogin(email, password)GraphQL mutation that verifies the credential and mints a signed JWT.Two packages, mirroring the
cognito/auth0sibling pattern:@webiny/self-hosted-auth— database-agnostic auth logic: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.jsonwebtoken), with the signing secret injected via config orWEBINY_SELF_HOSTED_AUTH_SECRET.LoginUseCase,SetPasswordUseCase, and aUserInstallerthat seeds the first admin (creates the user via api-core, then sets its password, with rollback on failure).CredentialsStorageOperationsseam so credential storage stays pluggable per database.@webiny/self-hosted-auth-sql— the thin Knex implementation ofCredentialsStorageOperations, following the repo's existing storage-ops pattern (lazy tableensure, JSONdatacolumn). 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; andSetPasswordUseCasecarries aTODO(authz)for self-service-vs-admin-reset enforcement. There is also a v0 tenancy decision (credentials resolved by email alone) documented inLoginUseCase.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