wasm_oidc_plugin/lib.rs
1/// This module contains all functions, calls and callbacks to execute the OpenID Authorization Code Flow
2mod auth;
3
4/// This module contains the structs of the `PluginConfiguration` and `OpenIdConfig`
5mod config;
6
7/// This module contains the Open ID discovery and JWKs loading logic
8mod discovery;
9
10/// This module contains the error types for the plugin
11mod error;
12
13/// This module contains the HTML templates for the auth page and UI elements.
14mod html;
15
16/// This module contains the pause context which is used when the filter is not configured.
17mod pause;
18
19/// This module contains the responses for the OpenID discovery and jwks endpoints
20mod responses;
21
22/// This module contains logic to parse and save the current authorization state in a cookie
23mod session;
24
25// std
26use std::sync::Mutex;
27use std::vec;
28
29// log
30use log::info;
31
32// proxy-wasm
33use proxy_wasm::traits::*;
34use proxy_wasm::types::*;
35
36// crate
37use crate::discovery::Root;
38
39// This is the initial entry point of the plugin.
40proxy_wasm::main! {{
41
42 proxy_wasm::set_log_level(LogLevel::Debug);
43
44 info!("starting plugin");
45
46 // This sets the root context, which is the first context that is called on startup.
47 // The root context is used to initialize the plugin and load the configuration from the
48 // plugin config and the discovery endpoints.
49 proxy_wasm::set_root_context(|_| -> Box<dyn RootContext> { Box::new(Root {
50 plugin_config: None,
51 open_id_providers: vec![],
52 open_id_resolvers: vec![],
53 waiting: Mutex::new(Vec::new()),
54 discovery_active: false,
55 }) });
56}}