pub trait SuccessPageRenderer: Send + Sync {
// Required method
fn render_success<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 PageContext<'life2>,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Renders the success page HTML shown to the user after authentication.
Register with crate::CliTokenClientBuilder::success_renderer. Takes precedence
over a plain HTML string set via crate::CliTokenClientBuilder::success_html.
§Example
use async_trait::async_trait;
use loopauth::{PageContext, SuccessPageRenderer};
struct MySuccessPage;
#[async_trait]
impl SuccessPageRenderer for MySuccessPage {
async fn render_success(&self, ctx: &PageContext<'_>) -> String {
let name = ctx.oidc().and_then(|c| c.name()).unwrap_or("there");
format!("<h1>Hi, {name}! You can close this tab.</h1>")
}
}Required Methods§
Sourcefn render_success<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 PageContext<'life2>,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn render_success<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 PageContext<'life2>,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Render the success page, returning the full HTML string.