Skip to content

feat(entra): validate directory passwords and issue ROPC refresh tokens - #633

Merged
hectorvent merged 2 commits into
floci-io:mainfrom
jwoa95:feat/632-directory-password-grant
Nov 9, 2026
Merged

hectorvent merged 2 commits into
floci-io:mainfrom
jwoa95:feat/632-directory-password-grant

Conversation

@jwoa95

@jwoa95 jwoa95 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Password grants now resolve provisioned users from the directory and use the same object id as authorization-code sign-in and Graph membership. Opt-in user validation checks the password hash and account status; permissive development authentication remains the default.

password grant -> tenant directory -> canonical user identity
  validation enabled -> require credentials -> verify password hash and account status
  v2 + explicit offline_access -> existing refresh-token store
  renewal -> existing client/token checks + opt-in account-status checks

Closes #632.

FLOCI_AZ_SERVICES_ENTRA_VALIDATE_USER_CREDENTIALS=true requires nonblank username, password and client id, rejects unknown users and wrong or missing password hashes, and rejects disabled accounts and either forced-password-change flag. Client validation remains a separate option. Strict password authentication cannot borrow the default directory's passwords for an unregistered tenant.

The startup seed format accepts optional user accountEnabled and passwordProfile fields. The existing directory writer hashes passwords with salted PBKDF2-HMAC-SHA256 before persistence. Repeat starts preserve existing profiles, and Graph member responses do not expose the password profile or hash.

V2 directory-backed password grants issue refresh tokens only when offline_access is explicitly requested and a client id is supplied. Renewal reuses the existing implementation. When user validation is enabled, account-status checks apply to both password-flow and code-flow refresh sessions. The policy and configuration are documented.

Evidence

  • Before: new regressions reproduced plaintext password storage, acceptance of wrong passwords, missing required-field and tenant checks, disabled/forced-change authentication, synthetic rather than directory object ids, absent password-grant refresh issuance, and renewal after an account was disabled or marked for a password change.
    After: endpoint and store regressions pass, including password/browser object-id and Graph-membership equivalence, hashed storage, explicit offline access, both forced-change flags, permissive defaults and renewal after actual access-token expiry.
  • Full ./mvnw -B -Dquarkus.http.test-port=0 test: 3,335 tests reported, 3,306 passed, 29 skipped, zero failures or errors. Docker-dependent checks were among the skips; no pass is claimed for skipped tests.
  • Five Java Entra compatibility tests pass in permissive mode, and the same five pass with both client and user validation enabled against a disposable seeded user. This includes real Azure Identity UsernamePasswordCredential acquisition and RS256 signature verification. Resolved versions: Azure Identity 1.18.4, Azure Core 1.57.0, MSAL4J 1.23.1.
  • JVM packaging and git diff --check pass. Independent Standards and Spec reviews have no remaining findings.

Azure Compatibility

Follows Microsoft's ROPC grant, refresh-token contract and passwordProfile fields. Errors use the existing OAuth/AADSTS envelope: missing fields 900144, invalid credentials 50126, disabled user 50057, required password change 50055, and invalid refresh session 70000.

This is an emulator subset. MFA, federation, full conditional access, live Azure tenant verification and complete password-change revocation are outside this change. Changing a password alone does not revoke refresh tokens, and clearing a forced-change flag can permit renewal again. Azure CLI, other SDK languages and native-image builds were not tested for this PR.

Merge Danger

Door: two-way for the validation setting; additive persisted seed records remain after disabling the setting.

Passwords written through the directory store become hashes. Disabling validation restores permissive authentication but does not restore plaintext passwords or delete seeded users. Provisioned password-grant users now receive their canonical directory object id, which can change the identity observed by clients that previously relied on the synthetic id.

Blast Radius: Entra.

Password-token identity and optional refresh issuance, opt-in credential/account validation, refresh account-status checks, and user seed provisioning. Existing refresh-token storage and lifecycle are reused.

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

Checklist

  • ./mvnw test passes locally (3,335 reported; 29 skipped; zero failures/errors)
  • New or updated integration and SDK tests added
  • Commit messages follow Conventional Commits
  • No more than 2 ready PRs and 4 total open PRs in this repository

Add opt-in user credential and renewal account-status validation while preserving permissive development defaults.

Closes floci-io#632
@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The change since the previous review appears safe to merge.

Summary

The PR adds optional directory password checks, shared user identities, password hashing, and refresh tokens for directory-backed password grants.

  • Password grants can identify provisioned users and optionally check their credentials.
  • Startup seeds can provision users with password profiles and account status.
  • Directory-backed password grants can create refresh sessions when callers request them.

Reviews (2) · Last reviewed commit: "fix(entra): show user credential validat..." · Reviewed by Greptile

@hectorvent hectorvent added documentation Improvements or additions to documentation entra-id Microsoft Entra ID (Azure AD) feature labels Nov 5, 2026
@hectorvent

Copy link
Copy Markdown
Member

Thanks for the thorough writeup. The tests make the strict paths easy to follow, and CI ran all the new classes.

(blocking) validate-user-credentials is missing from the Entra line in BannerLogger, next to validate-client-credentials. AGENTS.md asks for user-visible config there, and it is how someone debugging a rejected login sees the mode.

(follow-up, separate PR) PasswordGrant builds client_info from request.tenantId(), while the code and refresh grants use directoryTenantId(). At an unregistered tenant id in permissive mode, utid changes on the first refresh.

(follow-up, separate PR) assertEquals(oid, sub) in EntraCompatibilityTest pins an emulator shortcut, since Entra's sub is pairwise per application. I would drop that line from the SDK suite.

The banner line is what unblocks the merge.

@hectorvent hectorvent added the waiting-author Review posted; waiting on the PR author to respond label Nov 5, 2026
Report validate-user-credentials beside validate-client-credentials so rejected logins can be diagnosed from the active authentication mode.

Address the blocking review on floci-io#633.
@JWOA-BJSS

Copy link
Copy Markdown

Thanks for the thorough writeup. The tests make the strict paths easy to follow, and CI ran all the new classes.

(blocking) validate-user-credentials is missing from the Entra line in BannerLogger, next to validate-client-credentials. AGENTS.md asks for user-visible config there, and it is how someone debugging a rejected login sees the mode.

(follow-up, separate PR) PasswordGrant builds client_info from request.tenantId(), while the code and refresh grants use directoryTenantId(). At an unregistered tenant id in permissive mode, utid changes on the first refresh.

(follow-up, separate PR) assertEquals(oid, sub) in EntraCompatibilityTest pins an emulator shortcut, since Entra's sub is pairwise per application. I would drop that line from the SDK suite.

The banner line is what unblocks the merge.

done

@hectorvent

Copy link
Copy Markdown
Member

Thanks for the quick fix. fa46e95 adds validate-user-credentials to the Entra banner line next to validate-client-credentials, which clears the point I raised, and CI is green on this head.

The two follow-ups from my earlier comment (the client_info tenant on the password grant, and the oid equals sub assertion in the SDK suite) are still fine as a separate PR.

No blockers from my side.

@hectorvent hectorvent removed the waiting-author Review posted; waiting on the PR author to respond label Nov 9, 2026
@hectorvent
hectorvent merged commit 9b2a464 into floci-io:main Nov 9, 2026
15 checks passed
@hectorvent

Copy link
Copy Markdown
Member

🎉 This PR is included in version 0.17.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

McFizh pushed a commit to McFizh/floci-az that referenced this pull request Nov 16, 2026
# [0.17.0](floci-io/floci-az@0.16.0...0.17.0) (2026-11-15)

### Bug Fixes

* **aci:** report a failed container group action on the POST ([floci-io#623](floci-io#623)) ([b9ab61c](floci-io@b9ab61c))
* **apim:** keep child resources in the storage layer, keyed case-insensitively ([floci-io#651](floci-io#651)) ([d70496f](floci-io@d70496f))
* **blob:** answer Append Block with Last-Modified and x-ms-request-server-encrypted ([floci-io#631](floci-io#631)) ([f440fce](floci-io@f440fce)), closes [floci-io#587](floci-io#587)
* **blob:** apply SAS response-header overrides on read ([floci-io#629](floci-io#629)) ([04ec99e](floci-io@04ec99e))
* **containerapps:** drop an empty keyVaultUrl from a plain secret ([floci-io#649](floci-io#649)) ([68a9e13](floci-io@68a9e13)), closes [floci-io#576](floci-io#576)
* **containerapps:** report a managed environment's customDomainVerificationId ([floci-io#630](floci-io#630)) ([6b2b76f](floci-io@6b2b76f)), closes [floci-io#573](floci-io#573)
* **deployments:** list a nested deployment's resources in its parent ([floci-io#636](floci-io#636)) ([87c08bd](floci-io@87c08bd))
* **deployments:** read a parameter with a null reference as a plain value ([floci-io#635](floci-io#635)) ([e29d909](floci-io@e29d909))
* **eventgrid:** refuse a destination type floci-az cannot deliver to ([floci-io#622](floci-io#622)) ([aec34bd](floci-io@aec34bd))
* **eventhub:** skip discarded journal disk tuning ([floci-io#614](floci-io#614)) ([284f3fc](floci-io@284f3fc)), closes [floci-io#606](floci-io#606)
* **keyvault:** serve deleted vaults so terraform destroy can purge ([floci-io#634](floci-io#634)) ([f90d590](floci-io@f90d590)), closes [floci-io#624](floci-io#624)
* **keyvault:** store a vault's properties and support PATCH ([floci-io#624](floci-io#624)) ([9b8b44f](floci-io@9b8b44f))
* **monitor:** answer the deleted workspaces list ([floci-io#625](floci-io#625)) ([b60d698](floci-io@b60d698))
* **monitor:** keep the tags of workspaces and data collection endpoints and rules ([floci-io#660](floci-io#660)) ([df23147](floci-io@df23147)), closes [floci-io#659](floci-io#659)
* **queue:** accept Update Message without a body (visibility-only update) ([floci-io#621](floci-io#621)) ([c3215c8](floci-io@c3215c8)), closes [floci-io#620](floci-io#620)
* **queue:** return messages in the order they were sent ([floci-io#647](floci-io#647)) ([37b0f46](floci-io@37b0f46))
* **servicebus,eventhub:** wait for Artemis to answer AMQP before reporting a namespace ready ([floci-io#615](floci-io#615)) ([6fa9511](floci-io@6fa9511))
* **servicebus:** balance source accounting after explicit dead-letter ([floci-io#648](floci-io#648)) ([16f5f74](floci-io@16f5f74))
* **servicebus:** bound TCP connect by the readiness deadline ([floci-io#604](floci-io#604)) ([b06f481](floci-io@b06f481)), closes [floci-io#603](floci-io#603)
* **servicebus:** count deliveries after session lock expiry ([floci-io#645](floci-io#645)) ([ff31e3d](floci-io@ff31e3d))
* **servicebus:** restore stored entities when a broker starts ([floci-io#643](floci-io#643)) ([0d8dbab](floci-io@0d8dbab)), closes [floci-io#642](floci-io#642)
* **servicebus:** skip discarded journal disk tuning ([floci-io#606](floci-io#606)) ([db31031](floci-io@db31031)), closes [floci-io#605](floci-io#605)
* **storage:** answer an ARM container GET with the container's stored ETag and Last-Modified ([floci-io#617](floci-io#617)) ([f58abb4](floci-io@f58abb4))
* **storage:** answer an ARM container PUT with the container's stored ETag and Last-Modified ([floci-io#602](floci-io#602)) ([c5bbac8](floci-io@c5bbac8))
* **storage:** return the sku, kind and properties a PUT set ([floci-io#646](floci-io#646)) ([afc79e6](floci-io@afc79e6)), closes [floci-io#571](floci-io#571)
* **vm:** preserve request origin in polling URLs ([floci-io#628](floci-io#628)) ([9560864](floci-io@9560864)), closes [floci-io#626](floci-io#626)
* **vm:** report each power action's real outcome on its operation status ([floci-io#655](floci-io#655)) ([183f63d](floci-io@183f63d)), closes [floci-io#626](floci-io#626) [floci-io#626](floci-io#626)

### Features

* **arm:** refuse a token from another tenant under strict-tokens ([floci-io#619](floci-io#619)) ([fb76ca4](floci-io@fb76ca4))
* **arm:** refuse invalid Bearer tokens under strict-tokens ([floci-io#616](floci-io#616)) ([d6af59c](floci-io@d6af59c))
* **arm:** report each public region's physicalLocation ([floci-io#653](floci-io#653)) ([874b552](floci-io@874b552))
* **authorization:** serve role definitions and store role assignments ([floci-io#656](floci-io#656)) ([003a53c](floci-io@003a53c)), closes [floci-io#567](floci-io#567)
* **blob:** serve Set Blob Properties ([floci-io#654](floci-io#654)) ([d09366d](floci-io@d09366d))
* **deployments:** resolve Key Vault parameter references ([floci-io#641](floci-io#641)) ([3bcb475](floci-io@3bcb475)), closes [floci-io#635](floci-io#635) [floci-io#635](floci-io#635)
* **deployments:** serve deployments at management-group scope ([floci-io#640](floci-io#640)) ([0fe757d](floci-io@0fe757d))
* **deployments:** serve symbolic resource names (languageVersion 2.0) ([floci-io#637](floci-io#637)) ([17f00a3](floci-io@17f00a3))
* **deployments:** serve the CIDR functions and deployer ([floci-io#639](floci-io#639)) ([7fd4ade](floci-io@7fd4ade))
* **deployments:** serve the lambda functions and flatten ([floci-io#638](floci-io#638)) ([cddc4e0](floci-io@cddc4e0))
* **entra:** validate directory passwords and issue ROPC refresh tokens ([floci-io#633](floci-io#633)) ([9b2a464](floci-io@9b2a464)), closes [floci-io#632](floci-io#632)
* **tls:** answer for Azure's public hosts behind an opt-in setting ([floci-io#650](floci-io#650)) ([457de34](floci-io@457de34))
* **tls:** keep a trusted CA, accept your own, and warn when a client rejects the certificate ([floci-io#662](floci-io#662)) ([bac63e9](floci-io@bac63e9))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation entra-id Microsoft Entra ID (Azure AD) feature released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Entra: opt-in directory-backed password grant validation and refresh issuance

3 participants