Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Inject custom Jinja2 environment when rendering the subject template #2847

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions crates/handlers/src/upstream_oauth2/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ use serde::Deserialize;
use thiserror::Error;
use ulid::Ulid;

use super::{cache::LazyProviderInfos, client_credentials_for_provider, UpstreamSessionsCookie};
use super::{
cache::LazyProviderInfos, client_credentials_for_provider, template::environment,
UpstreamSessionsCookie,
};
use crate::{impl_from_error_for_route, upstream_oauth2::cache::MetadataCache};

#[derive(Deserialize)]
Expand Down Expand Up @@ -241,7 +244,7 @@ pub(crate) async fn get(
let (_header, id_token) = id_token.ok_or(RouteError::MissingIDToken)?.into_parts();

let env = {
let mut env = minijinja::Environment::new();
let mut env = environment();
env.add_global("user", minijinja::Value::from_serialize(&id_token));
env
};
Expand Down
Loading