woodglue.apps.server¶
Tornado application factory.
Tornado application factory for the woodglue JSON-RPC server.
Secrets in query strings stay out of the logs: create_app writes the access log
through log_request and filters the two Tornado loggers that record a failed
request's URI (tornado.general and tornado.application), so every route gets
redact_queries, including routes added later.
redact_queries(text)
¶
Hide the values of secret query parameters in text, keeping their names.
>>> redact_queries("GET /auth/callback/okta?code=abc&state=def (127.0.0.1)")
'GET /auth/callback/okta?code=…&state=… (127.0.0.1)'
>>> redact_queries("/auth/cli?state=a&state=b&code_challenge=c&redirect_uri=d")
'/auth/cli?state=…&state=…&code_challenge=c&redirect_uri=d'
>>> redact_queries("/auth/login?token=&next=/console/")
'/auth/login?token=…&next=/console/'
>>> redact_queries("/auth/login?next=%2Fauth%2Fcli%3Fstate%3Dabc")
'/auth/login?next=…'
>>> redact_queries("/x?%74oken=abc"), redact_queries("/x?a=\xa0&code=abc")
('/x?%74oken=…', '/x?a=\xa0&code=…')
Source code in src/woodglue/apps/server.py
log_request(handler)
¶
Tornado's default access log line and levels, with redact_queries applied.
Source code in src/woodglue/apps/server.py
create_app(namespaces, config=None, engine_registry=None, mounts=None, auth_store=None, ui_processes=None)
¶
Build a Tornado Application with JSON-RPC and optional docs/UI routes.
namespaces maps prefix strings to (Namespace, NamespaceEntry) tuples.
The plain Namespace dict (all namespaces) is stored in app settings for
internal use. The method_index is filtered by expose_api.
With auth enabled, auth_store defaults to one opened on
config.storage.auth_db, which must then be set; pass it to share the
instance the system namespace uses. Without config, auth is disabled. ui_processes supervises Process-backed UIs; the caller
starts and stops it (see wgl start).
Source code in src/woodglue/apps/server.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |