Expand description
San Mateo plugin for autumn-web.
The plugin installs San Mateo into an autumn app with one call. San Mateo keeps OAuth tokens and API keys, refreshes tokens, sends authorized calls through a proxy, and runs syncs and actions.
- API: the San Mateo REST API under a route prefix (default
/san-mateo). autumn lists the routes inautumn routes. - Config: the
[san_mateo]section. It holds env var names, never secrets. - State:
SanMateoServicegives handlers and jobs the service. - Operations: a
san_mateohealth indicator, background loops, and a drain at shutdown.
Notes:
- autumn needs one or more routes of the app. The nested San Mateo router does not count.
- With
[security.csrf] enabled = true, add the prefix toexempt_paths. San Mateo clients send tokens, not cookies. Else the startup fails and the error gives the fix. - The hosted connect page needs
[security.headers.csp_nonce] enabled = true. The plugin then puts the autumn nonce in the page. - At the root prefix (
"/"), the plugin merges its router.autumn routes auditcannot prove a merged router, so the audit reports it. - The background loops start in the startup hook, in roles that run
workers. When
san-mateo-harvestruns the syncs, set[san_mateo.background] run_syncs = false. Else each sync runs two times. - With
.service(san), theserver_urlofsanmust end with the prefix. Else OAuth callbacks give 404. The plugin logs a warning.
The autumn_app example (examples/autumn_app) is a full app that you
can run.
use autumn_plugin_san_mateo::SanMateoPlugin;
autumn_web::app()
.plugin(SanMateoPlugin::new().prefix("/san-mateo"))
.run()
.await;Re-exports§
pub use config::SanMateoConfig;pub use san_mateo;
Modules§
- config
[san_mateo]configuration.
Structs§
- SanMateo
Health - Shows the state of the San Mateo service.
- SanMateo
Plugin - San Mateo plugin for autumn-web.
- SanMateo
Runtime - A started plugin.
- SanMateo
Service - The started San Mateo service. The plugin puts it in the app state.
Enums§
- Plugin
Error - An error from the plugin. A message never holds a secret value.
Constants§
- AUTUMN_
WEB_ REQUIREMENT - The
autumn-webversions that this plugin supports. - DEFAULT_
PREFIX - Default route prefix.
- INDICATOR_
NAME - The registration name of the indicator.
- PLUGIN_
NAME - The plugin name. autumn uses it to find a plugin that is added two times.
Functions§
- autumn_
error - Converts a San Mateo error to an
AutumnErrorwith the same HTTP status. Use it with?in autumn handlers. - plugin_
contract - The contract that
SanMateoPlugindeclares to autumn.