From af50a1db0238d6d9d76df2a63cb8e8bbf5ccd295 Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Fri, 14 Aug 2026 17:21:17 +0100 Subject: [PATCH] Format --- crates/templates/src/context.rs | 77 ++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/crates/templates/src/context.rs b/crates/templates/src/context.rs index adb5d148c..daf8ca4cf 100644 --- a/crates/templates/src/context.rs +++ b/crates/templates/src/context.rs @@ -825,16 +825,17 @@ impl TemplateContext for PolicyViolationContext { Vec::new(), ); - let authorization_grant_invalid_scope = PolicyViolationContext::for_authorization_grant( - grant, - client.clone(), - vec![Violation { - msg: "scope 'foo' not allowed".to_owned(), - redirect_uri: None, - field: None, - variant: None, - }], - ); + let authorization_grant_invalid_scope = + PolicyViolationContext::for_authorization_grant( + grant, + client.clone(), + vec![Violation { + msg: "scope 'foo' not allowed".to_owned(), + redirect_uri: None, + field: None, + variant: None, + }], + ); let device_code_grant = PolicyViolationContext::for_device_code_grant( DeviceCodeGrant { id: Ulid::from_datetime_with_rng(now, rng), @@ -850,33 +851,41 @@ impl TemplateContext for PolicyViolationContext { locale: None, }, client.clone(), - Vec::new() + Vec::new(), ); - let device_code_grant_invalid_scope = PolicyViolationContext::for_device_code_grant( - DeviceCodeGrant { - id: Ulid::from_datetime_with_rng(now, rng), - state: mas_data_model::DeviceCodeGrantState::Pending, - client_id: client.id, - scope: [OPENID].into_iter().collect(), - user_code: Alphanumeric.sample_string(rng, 6).to_uppercase(), - device_code: Alphanumeric.sample_string(rng, 32), - created_at: now - Duration::try_minutes(5).unwrap(), - expires_at: now + Duration::try_minutes(25).unwrap(), - ip_address: None, - user_agent: None, - locale: None, - }, - client, - vec![Violation { - msg: "user has too many active sessions".to_owned(), - redirect_uri: None, - field: None, - variant: Some(ViolationVariant::TooManySessions { need_to_remove: 1 }), - }], - ); + let device_code_grant_invalid_scope = + PolicyViolationContext::for_device_code_grant( + DeviceCodeGrant { + id: Ulid::from_datetime_with_rng(now, rng), + state: mas_data_model::DeviceCodeGrantState::Pending, + client_id: client.id, + scope: [OPENID].into_iter().collect(), + user_code: Alphanumeric.sample_string(rng, 6).to_uppercase(), + device_code: Alphanumeric.sample_string(rng, 32), + created_at: now - Duration::try_minutes(5).unwrap(), + expires_at: now + Duration::try_minutes(25).unwrap(), + ip_address: None, + user_agent: None, + locale: None, + }, + client, + vec![Violation { + msg: "user has too many active sessions".to_owned(), + redirect_uri: None, + field: None, + variant: Some(ViolationVariant::TooManySessions { + need_to_remove: 1, + }), + }], + ); - [authorization_grant, authorization_grant_invalid_scope, device_code_grant, device_code_grant_invalid_scope] + [ + authorization_grant, + authorization_grant_invalid_scope, + device_code_grant, + device_code_grant_invalid_scope, + ] }) .collect(), )