Repository navigation
feat: provision users from the userinfo endpoint (opaque bearer tokens) - #1564
Open
alex-yatsenko wants to merge 1 commit into
Open
alex-yatsenko wants to merge 1 commit into
alex-yatsenko wants to merge 1 commit into
Conversation
UserInfoValidator returned an empty string from getProvisioningStrategy() with a TODO, so users authenticated with an **opaque** bearer token were never provisioned: the token carries no claims, and nothing fetched them from the provider's userinfo endpoint either. Providers that issue opaque access tokens (instead of self-encoded JWTs) therefore got no group membership and no attribute sync on the bearer path. Add UserInfoProvisioning, the counterpart of SelfEncodedTokenProvisioning: it takes the payload from the provider's userinfo endpoint instead of decoding it out of the token. UserInfoValidator now names that strategy, so the existing "bearer provisioning" setting works for opaque tokens too. The class deliberately mirrors SelfEncodedTokenProvisioning and reuses ProvisioningService, so the group whitelist filter keeps applying exactly as before. Refs nextcloud#1258 Refs nextcloud#1255 Signed-off-by: Александр Яценко <286242565+alex-yatsenko@users.noreply.github.com>
alex-yatsenko
force-pushed
the
feat/userinfo-provisioning
branch
from
October 7, 2026 14:12
f8259a5 to
6be4327
Compare
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.
Implements the TODO in
UserInfoValidator::getProvisioningStrategy()— the one tracked in #1258, and related to #1255.Why
UserInfoValidatorvalidates opaque access tokens by calling the provider'suserinfoendpoint, but it returned an empty string fromgetProvisioningStrategy(), andBackendskips provisioning entirely when the strategy is empty:A self-encoded JWT carries its claims, so
SelfEncodedTokenProvisioningcan decode them. An opaque token carries nothing — the claims only exist behinduserinfo. For providers that issue opaque tokens the account still gets created, but group membership and attribute sync never happen, and nothing is logged: the failure is completely silent.What
OCA\UserOIDC\User\Provisioning\UserInfoProvisioning— counterpart ofSelfEncodedTokenProvisioning, deliberately mirroring it and differing only in where the payload comes from (OIDCService::userinfo()instead ofJWT::decode()). It reusesProvisioningService::provisionUser(), so the group whitelist (groupWhitelistRegex) and all mapping settings keep applying exactly as before — it does not add a way around them.UserInfoValidator::getProvisioningStrategy()now returnsUserInfoProvisioning::class. If fetchinguserinfofails at provisioning time it logs the error and returnsnull: the very same token was just validated against that endpoint in the validator, so a failure here is a transport failure, not an authorization one.ProvisioningService, endpoint failure is handled and does not provision).Testing
php -lon all changed files.tests/unit/User/Provisioning/UserInfoProvisioningTest.php.We are happy to reshape this to whatever the maintainers prefer (e.g. sharing code with
SelfEncodedTokenProvisioning, or wiring the strategy differently) — the point is that the bearer path should provision like the interactive one does.Refs #1258
Refs #1255