Page handler selection initialization¶
Every page that derives from BolContextModel runs this operation before its handler. It establishes the per-request context that the menu and policy header layers build on.
| Field | Value |
|---|---|
| Operation ID | OP-03 |
| Trigger | Razor Pages handler selection on a BolContextModel page |
| Inputs | HTTP request, BolContext cookie, session |
| Outputs | Populated WebContext, contextCookie, RequestHelper, MyApplicationName |
| Primary components | BolContextModel.OnPageHandlerSelected |
| Entry point | src/BolMiddleware/Models/BolContextModel.cs |
Steps¶
- Create a
RequestHelperfor the currentHttpRequest. - Read the application name from the root
ApplicationNameconfiguration value throughGetRequiredValue; a missing value throws. - Read the
BolContextcookie intocontextCookiewhen it exists (BR-BOLMIDDLEWARE-004). - Later, in
OnPageHandlerExecutingafter model binding, resolve the web context as described in Resolve web context (BR-BOLMIDDLEWARE-001). - Still in
OnPageHandlerExecuting, for an external user run Capture external user information, which callsISecurityClient.GetExternalUser(BR-BOLMIDDLEWARE-005, BR-BOLMIDDLEWARE-006). - If the user is internal: skip the lookup.
- Make the
WebContextavailable to the consumer handler.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Handler selected]) --> S1[Create RequestHelper]
S1 --> S2[Read ApplicationName]
S2 --> S3[Read BolContext cookie]
S3 --> S3b([Handler executing])
S3b --> S4[Resolve web context]
S4 --> D{External user?}
D -->|Yes| S5[Capture external user information]
D -->|No| EndOk([Handler runs])
S5 --> EndOk
Failure and edge-case behavior¶
- A missing
ApplicationNameconfiguration value throws before the handler runs. The consumer sample places the value underAppSettings, which may not match the root key read here**. ContextCookiedeserialization trusts the unsigned cookie content; the cookie is not integrity protected.
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/Request/RequestHelper.cs