s365b.setup.connect¶
The “Connect tenant” step of the setup wizard.
State lives in the setting table (setup.connect; the device code
itself in the encrypted part), so the UI can poll and an API restart does
not lose track. Flow:
start()requests a device code and shows the user code.The UI calls
poll()every few seconds. Once the admin has signed in, provisioning starts in the background andpoll()reports its steps.The result (tenant, app registrations, encrypted private keys) is stored and Microsoft sign-in is switched on. The delegated token is then dropped; nothing that could refresh it was ever requested.
Attributes¶
Classes¶
One line of the progress list. |
|
Advanced wizard options. |
|
Progress of the "Connect tenant" step, as shown in the wizard. |
Functions¶
|
Work out which apps to create and what each may do. |
|
Return the stored, unexpired app certificates as base64 DER. |
|
Return parsed configs of the enabled, installed modules. |
|
Return the current wizard state. |
|
Request a device code for a tenant administrator. |
|
Abandon a pending sign-in (not a running provisioning). |
|
Advance the flow: check the sign-in, or report provisioning progress. |
|
At startup: end a provisioning the previous server process was running. |
|
Wait for background provisioning to finish (tests, shutdown). |
Module Contents¶
- class s365b.setup.connect.SetupOptions[source]¶
Bases:
s365b.core.settings_store.SettingsGroupAdvanced wizard options.
- Variables:
public_client_id – Public client used for the device code sign-in. Default: Microsoft Graph Command Line Tools.
- class s365b.setup.connect.ConnectState[source]¶
Bases:
s365b.core.settings_store.SettingsGroupProgress of the “Connect tenant” step, as shown in the wizard.
- s365b.setup.connect.plans(services: s365b.core.services.Services, enabled: dict[str, object], base_url: str, current_certs: dict[s365b.db.models.AppPurpose, str] | None = None) list[s365b.setup.provision.AppPlan][source]¶
Work out which apps to create and what each may do.
- Parameters:
services – Process services (module registry).
enabled – Parsed configs of the enabled modules, by module ID.
base_url – Public URL of this server.
current_certs – Base64 DER of each app’s certificate in use now, kept registered during rotation.
- Returns:
Plans for the Backup, Restore and Sign-in apps.
- async s365b.setup.connect.current_certificates(services: s365b.core.services.Services) dict[s365b.db.models.AppPurpose, str][source]¶
Return the stored, unexpired app certificates as base64 DER.
- Parameters:
services – Process services.
- Returns:
Certificate by app purpose.
- async s365b.setup.connect.enabled_modules(services: s365b.core.services.Services) dict[str, object][source]¶
Return parsed configs of the enabled, installed modules.
- Parameters:
services – Process services.
- Returns:
Config by module ID.
- async s365b.setup.connect.load_state(services: s365b.core.services.Services) ConnectState[source]¶
Return the current wizard state.
- Parameters:
services – Process services.
- Returns:
The state.
- async s365b.setup.connect.start(services: s365b.core.services.Services, actor: str) ConnectState[source]¶
Request a device code for a tenant administrator.
- Parameters:
services – Process services.
actor – Username starting the connection (for the audit log).
- Returns:
The new state, with the user code to show.
- Raises:
DeviceCodeError – If Entra refuses to start the flow.
RuntimeError – If provisioning is already running.
- async s365b.setup.connect.cancel(services: s365b.core.services.Services) ConnectState[source]¶
Abandon a pending sign-in (not a running provisioning).
- Parameters:
services – Process services.
- Returns:
The reset state.
- async s365b.setup.connect.poll(services: s365b.core.services.Services) ConnectState[source]¶
Advance the flow: check the sign-in, or report provisioning progress.
- Parameters:
services – Process services.
- Returns:
The current state.
- s365b.setup.connect.INTERRUPTED = 'Interrupted: the server restarted while setting up. Start again: apps already created in...[source]¶
- async s365b.setup.connect.recover_interrupted(services: s365b.core.services.Services) bool[source]¶
At startup: end a provisioning the previous server process was running.
Provisioning runs inside the API process; after a restart nothing is working on it any more, and the wizard would wait forever.
- Parameters:
services – Process services.
- Returns:
Whether a provisioning was marked interrupted.