Repository navigation
Architecture
This page is for maintainers and operators who need to understand the plugin's boundaries and the path a successful login takes.
| Area | Responsibility |
|---|---|
Auth |
Renders the login option and handles the provider callback. |
OpenIDConnectClient |
Builds authorization requests, exchanges codes, validates tokens, retrieves UserInfo, and builds logout URLs. |
Session |
Stores short-lived OIDC request data in WordPress transients, keyed by a secure session cookie. |
User |
Creates, updates, binds, and signs in WordPress users. |
RolesDatabase and RolesSync
|
Maintain five SOL graph tables and synchronize validated UserInfo role data. |
RolesAuthorization |
Evaluates active assignments against every login-mapping rule, then reconciles all plugin-managed WordPress roles; any matching deny blocks login. |
RolesAdmin and RolesExplorer
|
Provide mapping rules, user previews, contextual help, and read-only assignment browsing. |
WooCommerceRestrictions |
Applies product allow/deny conditions to WooCommerce purchase and cart validation. |
Settings |
Registers OIDC and general administrator settings. |
SiteHealth and ProviderHealth
|
Verify runtime, configuration, provider, redirect, logging, and cleanup readiness. |
Logging and CronJobs
|
Store administrator-facing audit data and remove expired log rows daily. |
sequenceDiagram
participant Browser
participant WordPress
participant SOL as Scouts Online
Browser->>WordPress: Open login page or shortcode
WordPress->>Browser: Render local OIDC login link
Browser->>WordPress: Request local OIDC login action
WordPress->>WordPress: Create secure session, state, nonce, and PKCE verifier
WordPress->>SOL: Authorization request with PKCE S256
SOL->>Browser: Authenticate and authorize
Browser->>WordPress: Redirect URI with code and state
WordPress->>WordPress: Verify state and load nonce/verifier
WordPress->>SOL: Token request with authorization code and verifier
SOL->>WordPress: ID token and access token
WordPress->>WordPress: Validate ID token signature and claims
WordPress->>SOL: UserInfo request with access token
SOL->>WordPress: User claims
WordPress->>WordPress: Create or update local user
WordPress->>WordPress: Synchronize optional SOL role graph
WordPress->>WordPress: Evaluate all login rules and apply managed roles, or stop if denied
WordPress->>WordPress: Set WordPress auth cookie for allowed login
WordPress->>Browser: Redirect after login
The login page and shortcodes point to a local OIDC login action. After the
visitor selects that action, the plugin creates a random session ID in the
__Host-scouting_oidc_session cookie before redirecting to the provider. The
cookie is host-only, secure, HTTP-only, uses SameSite=Lax, and expires after
one hour. The session ID keys short-lived transient values for the redirect URI,
state values, nonces, PKCE verifiers, pending post-login redirects, and the
saved ID token.
State, nonce, and PKCE values are associated with a particular authorization request. This allows concurrent login attempts without one request overwriting another. The plugin clears these values after the code exchange and rotates the session ID after successful authentication.
The plugin reads the provider discovery document and JWKS, caching both for one hour. It accepts RS256 ID tokens only and verifies the signing certificate from the provider's JWKS. It validates the issuer, audience, expiry, issued-at time, subject, and nonce before using any identity information.
User profile data comes from the UserInfo endpoint only after the ID token is
validated and the UserInfo sub matches the validated token subject.
- The local WordPress username is the SOL member ID.
- The OIDC
subis saved in user metadata and binds a SOL identity to that account. - Existing OIDC users without a stored subject are bound during their next successful login.
- If a local account's username is already linked to a different subject, login is rejected.
- When automatic account creation is enabled, a new WordPress account is created when no matching SOL member ID exists.
- If the provider email already belongs to another WordPress account, the configured duplicate-email policy determines whether a plus-addressed email is used or login stops with an error.
- Role synchronization and mapping happen after account creation/update and before sign-in. A deny can leave a created or updated account without completing login.
- All matching allow rules contribute WordPress roles; any matching deny blocks OIDC login. New unmatched users receive the default role. Plugin Settings can optionally add it alongside mapped roles for new and existing users. Existing unmatched users receive no replacement role. Successful logins reconcile positively owned roles and preserve independent roles.
See General settings for administrator-facing controls.
The plugin stores data in several WordPress storage areas. The five SOL role tables below contain the synchronized organisation and assignment graph; they do not contain the user's full OIDC profile.
erDiagram
ORGANISATIONS ||--o{ ORGANISATION_PARENTS : "is child"
ORGANISATIONS ||--o{ ORGANISATION_PARENTS : "is parent"
ORGANISATIONS ||--o{ ORGANISATION_UNITS : contains
ORGANISATION_UNITS ||--o{ ROLES : defines
ROLES ||--o{ ROLE_ASSIGNMENTS : assigned
WP_USERS ||--o{ ROLE_ASSIGNMENTS : receives
ORGANISATIONS {
char organisation_id PK
varchar name
datetime last_seen_at
}
ORGANISATION_PARENTS {
char child_organisation_id PK
char parent_organisation_id PK
datetime last_seen_at
}
ORGANISATION_UNITS {
bigint organisation_unit_id PK
char organisation_id
varchar name
varchar unit_type
varchar game_section_type "nullable"
varchar category "nullable"
varchar nature "nullable"
datetime last_seen_at
}
ROLES {
bigint role_id PK
bigint organisation_unit_id
varchar role_name
varchar role_type
varchar member_type "nullable"
varchar category "nullable"
datetime last_seen_at
}
ROLE_ASSIGNMENTS {
bigint user_id PK
bigint role_id PK
datetime start_date PK
datetime end_date "nullable"
datetime last_seen_at
}
WP_USERS {
bigint ID PK
}
The diagram shows logical relationships, not database-enforced foreign keys.
The plugin stores related IDs and joins them in its queries; the role schema
does not declare foreign-key constraints. The WordPress users table is shown
because ROLE_ASSIGNMENTS.user_id identifies a local user. Table names use the
site's database prefix, such as {prefix}scouting_oidc_sol_organisations.
| Table | Columns and keys |
|---|---|
{prefix}scouting_oidc_sol_organisations |
organisation_id CHAR(6) primary key; name VARCHAR(255); last_seen_at DATETIME; index on last_seen_at. Organisation IDs are strings so leading zeroes are preserved. |
{prefix}scouting_oidc_sol_organisation_parents |
child_organisation_id CHAR(6) and parent_organisation_id CHAR(6) composite primary key; last_seen_at DATETIME; indexes on parent_organisation_id and last_seen_at. This table models the organisation-to-parent relationship and supports multiple parents. |
{prefix}scouting_oidc_sol_organisation_units |
organisation_unit_id BIGINT UNSIGNED primary key; organisation_id CHAR(6); name, unit_type, game_section_type, category, and nature as VARCHAR(255); last_seen_at DATETIME; indexes on organisation_id and last_seen_at. game_section_type, category, and nature are nullable. |
{prefix}scouting_oidc_sol_roles |
role_id BIGINT UNSIGNED primary key; organisation_unit_id BIGINT UNSIGNED; role_name and role_type as VARCHAR(255); nullable member_type and role category as VARCHAR(255); last_seen_at DATETIME; indexes on organisation_unit_id and last_seen_at. |
{prefix}scouting_oidc_sol_role_assignments |
user_id BIGINT UNSIGNED, role_id BIGINT UNSIGNED, and start_date DATETIME(6) composite primary key; nullable end_date DATETIME(6); last_seen_at DATETIME; indexes on role_id and last_seen_at. |
Organisation unit unit_type, game_section_type, category, and nature,
and role role_type, member_type, and category, are stored as strings.
Although the Scouts Online API describes these as enums, the synchronizer does
not hard-code their allowed values. This lets it retain new API values without
rejecting an otherwise valid role graph.
| Storage | Data stored |
|---|---|
WordPress users and usermeta tables |
Local account identity and profile data. Plugin user metadata includes the OIDC subject and account marker, the SOL profile URL, optional synchronized profile fields, the scouting_oidc_roles_available synchronization status, and scouting_oidc_owned_wordpress_role tracking for WordPress roles granted by the plugin. See Users, Privacy and Data Lifecycle. |
WordPress options table |
Plugin configuration, including OIDC settings, role-mapping rules (scouting_oidc_sol_role_mapping_rules), and the global WooCommerce SOL sign-in requirement. Treat backups of options as sensitive because configuration includes credentials. |
WordPress postmeta table |
Per-product WooCommerce SOL access settings, including allowed and denied organisation/role IDs and matching switches. Product metadata keys use the _scouting_oidc_ prefix. |
{prefix}scouting_oidc_logs |
Operational log rows: ID, optional WordPress and SOL user IDs, component, level, UTC timestamp, and message. Logs are retained according to the configured log-retention period. |
| WordPress transients | Short-lived OIDC request state, nonce, PKCE verifier, redirect state, and ID token, with a one-hour lifetime. Transients may be held in the database or an external object cache. |
The SOL role graph is refreshed at successful OIDC login. The user's assignment rows are replaced by the current assignment list; shared organisation, unit, and role records are upserted. A missing role graph preserves the stored rows but makes them unavailable for authorization. Deleting a WordPress user removes their assignment rows; shared graph rows may remain. Role-table schema upgrades are checked during plugin startup. See Users, Privacy and Data Lifecycle for profile data, retention, deletion, and backup considerations.
The plugin adds the Scouting login option to the normal WordPress login form and registers the following public shortcodes:
[scouting_oidc_button][scouting_oidc_link]
It also adds settings, support, shortcode, logging, SOL Role Explorer, and
SOL Role Mapping screens under the Scouting OIDC administrator menu.
WooCommerce products gain a SOL Access tab when WooCommerce is active.
Login redirects run through the WordPress
wp_login hook. OIDC account creation fires scouting_oidc_user_register;
scouting_oidc_wp_login runs only if core login callbacks return without
terminating the request. See the redirect limitation in
Developer Integration.
Role tables are checked for upgrades on plugins_loaded. User deletion removes the user's
SOL assignments but preserves historical log entries. Product variations inherit
their parent product's SOL restrictions. See
SOL Roles and Mapping and
WooCommerce SOL Access for matching semantics.
- Home
- Introduction
- Installation
- Configuration
- Shortcodes
- OpenID Connect
- Operations and Troubleshooting
- Users, Privacy and Data Lifecycle
- Account Management and Authorization
- SOL Roles and Mapping
- WooCommerce SOL Access
- Migration, Backup and Recovery
- Developer Integration
- FAQ and Known Limitations
- Architecture