Resolve web context¶
The BOL web context carries the user's current policy, claim, and application across the BOL applications. This operation chooses the first available source so the context follows the user from one application to the next.
| Field | Value |
|---|---|
| Operation ID | OP-04 |
| Trigger | Page handler selection |
| Inputs | BolContext cookie, referring application, WebContextId form value, cid query value, session |
| Outputs | A ContextHelper assigned to WebContext |
| Primary components | BolContextModel.OnPageHandlerExecuting (through TryGetContext), WebContextService.NewContext, RequestHelper |
| Entry point | src/BolMiddleware/Models/BolContextModel.cs |
Steps¶
- Determine the session id. When the environment key
bolmiddleware:UseSessionCookieis true, read it from the cookie named bybolmiddleware:SessionCookieName; otherwise use the request session id (BR-BOLMIDDLEWARE-020). - If the
BolContextcookie holds a context with content, use it (BR-BOLMIDDLEWARE-001, BR-BOLMIDDLEWARE-003). - Otherwise re-read the cookie once and use it when it now has content.
- Otherwise, if the request has a referring application, call
GetContext(sessionId, applicationName)on the BOL Context API throughWebContextService. - Otherwise, if a
WebContextIdform value or acidquery value is present, callGetContext(contextId). - Otherwise read the context from the session.
- If none of the sources produced a context, call
NewContext(sessionId, applicationName), add the middleware session cookie, and set theBolContextcookie. - On API failure: the service logs and returns an empty result (BR-BOLMIDDLEWARE-021).
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Handler selected]) --> S0[Determine session id]
S0 --> D1{Cookie has content?}
D1 -->|Yes| EndOk([Use context])
D1 -->|No| D2{Referring application?}
D2 -->|Yes| S2[GetContext by session and application]
D2 -->|No| D3{cid or WebContextId?}
D3 -->|Yes| S3[GetContext by id]
D3 -->|No| D4{Session context?}
D4 -->|Yes| S4[Read session context]
D4 -->|No| S5[NewContext and set cookies]
S2 --> EndOk
S3 --> EndOk
S4 --> EndOk
S5 --> EndOk
Failure and edge-case behavior¶
- A context id from the query string or form is accepted without an ownership check, so a user can load another context by guessing its id.
UseSessionCookieandSessionCookieNameare read throughIEnvironmentClienton every request; missing-key behavior is unknown**.GetFrameworkLoggingInfowrites form, query, and context values to the log, which can include personal data.
Note: Statements marked with
**could not be confirmed; treat as unknown until verified.
Related documentation¶
- Index
- Overview
- Architecture
- Dependencies
- Configuration
- Operations and processes
- Business rules
- Security and authorization
- Service registration
- API reference
Sources¶
- src/BolMiddleware/Models/BolContextModel.cs
- src/BolMiddleware/Services/Context/WebContextService.cs
- src/BolMiddleware/Services/Context/WebContextExtensions.cs
- src/BolMiddleware/Services/Request/RequestHelper.cs