Repository navigation
BFF: baseUrl is the backend, and permissions come from the session - #62
Open
brionmario wants to merge 1 commit into
Open
brionmario wants to merge 1 commit into
brionmario wants to merge 1 commit into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
🔀 Cross-SDK feature parity, ports raisedThis pull request is labelled Ports (DO NOT EDIT)
3 of 3 sibling SDKs accounted for. Every sibling SDK is accounted for. The contract is in the SDK development specification. |
This was referenced Oct 30, 2026
Member
Author
|
Merged
7 of 13 tasks
brionmario
force-pushed
the
granted-scopes-backend-session
branch
from
October 30, 2026 08:44
246b562 to
36e3f3d
Compare
6 of 13 tasks
DonOmalVindula
previously approved these changes
Oct 30, 2026
When sign-in runs on a backend (endpoints.backend), the top-level baseUrl is the backend's base URL and must use HTTPS. BackendEndpoints.baseUrl is removed. Backend endpoints given as paths resolve against baseUrl; an endpoint given as an absolute HTTPS URL is used as it is, and http:// is refused. The app reaches its API only through the backend's proxy, and the backend decides where those requests go. A path starting with "/" goes to baseUrl + proxy + the path, and a URL already under the proxy is sent as it is rather than prefixed again. Any other absolute URL is refused unless it is a bypass URL. Management operations build their collection URLs on the proxy and send them through it with the session handle and no access token: the backend attaches it, and no token is requested from the backend. In backend mode, getGrantedPermissions() reads the permissions from the backend's session (BackendSession.scope, the token response's scope) and never asks for the access token. A session without scope grants nothing. Redirect mode is unchanged. Signed-off-by: Brion <info@brionmario.com>
brionmario
force-pushed
the
granted-scopes-backend-session
branch
from
October 30, 2026 11:51
36e3f3d to
878cb16
Compare
Merged
6 of 13 tasks
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.
Purpose
Two changes to backend mode (
endpoints.backend, sign-in on a backend the app owns, RFC 10017 §6.1), ported alongside the JavaScript SDKs.1.
baseUrlis the backend, and the API is reached only through its proxy. Until now the backend's address wasendpoints.backend.baseUrl, and the top-levelbaseUrlmeant the API whose requests go through the proxy. In backend mode the app never talks to the ThunderID server or to the API: it talks to the backend, which holds the tokens and decides where API requests go. So the top-levelbaseUrlis now the backend, and the app's API base is the backend's proxy. The client no longer needs, or is told, the API's real address.2. Permissions come from the session. In backend mode the access token stays on the backend, but
getGrantedPermissions()read the permissions by decoding the access token, whichgetAccessToken()asks the backend's token endpoint for. A BFF doesn't offer one, since keeping tokens away from the client is the point of the pattern. The app saw no permissions, andGrantedPermissionsNotifierhid everything. A client learns what it was granted from the token response'sscope(RFC 6749 §5.1), so the backend reports it with the session and the app reads it from there.Approach
resolve_backend_endpoints.dart): the top-levelbaseUrlmust use HTTPS. Each endpoint is a path that resolves againstbaseUrl, or an absolute HTTPS URL that's used as it is; anything else is refused before any network call.BackendEndpoints.baseUrlis removed.BackendClient.toProxyUrl), all going through the proxy with the session handle, the backend attaching the access token:/goes tobaseUrl+proxy+ the path;baseUrl+proxy+ the collection), and requests go through the backend's HTTP client with the session handle and no access token: none is requested from the backend. Collection overrides inendpointsstill win. The client's config is now kept in backend mode, somanagementno longer throws there.BackendSessiongains an optionalscope, parsed infromMap, so every session read keeps it.getGrantedPermissions()reads only the session'sscopeand never callsgetAccessToken(). Redirect mode still reads the access token'sscopeorscopesclaim.THUNDERID_BACKEND_URLbecomes the SDK'sbaseUrl; the backend's proxy fronts the ThunderID server.Related Issues
Related PRs
baseUrlconfig as the BFF's base URL javascript-sdks#149:baseUrlis the backend, in the JavaScript SDKs.Checklist
test/resolve_backend_endpoints_test.dart: the backend inbaseUrl, HTTPS for it, an absolute HTTPS endpoint, refused endpoints.test/backend_mode_test.dart: a relative path through the proxy, a URL already under the proxy not prefixed again, URLs outside the proxy refused, management URLs on the proxy and sent without an access token, and the "granted permissions" group.)breaking changelabel added.parity/prs-raisedorparity/prs-not-neededadded.parity/prs-raised, the port links are posted as a reply on the parity check's comment.Not run locally: Flutter isn't installed on the machine this was written on, so
flutter analyzeandflutter test, including the new tests, haven't run. CI is the first run of both.Security checks
Every backend URL, including an absolute endpoint, must use HTTPS. In backend mode the client never asks for an access token: management requests and API calls go through the backend's proxy with the session handle, and permissions come from the session. The permissions decide only what the app shows; the server still checks every request.