junobuild_auth/automation/
impls.rs1use crate::automation::types::{AutomationScope, PrepareAutomationError};
2use crate::openid::credentials::types::errors::VerifyOpenidCredentialsError;
3use junobuild_shared::types::state::ControllerScope;
4
5impl From<VerifyOpenidCredentialsError> for PrepareAutomationError {
6 fn from(e: VerifyOpenidCredentialsError) -> Self {
7 match e {
8 VerifyOpenidCredentialsError::InvalidObservatoryId(err) => {
9 PrepareAutomationError::InvalidObservatoryId(err)
10 }
11 VerifyOpenidCredentialsError::GetOrFetchJwks(err) => {
12 PrepareAutomationError::GetOrFetchJwks(err)
13 }
14 VerifyOpenidCredentialsError::GetCachedJwks => PrepareAutomationError::GetCachedJwks,
15 VerifyOpenidCredentialsError::JwtFindProvider(err) => {
16 PrepareAutomationError::JwtFindProvider(err)
17 }
18 VerifyOpenidCredentialsError::JwtVerify(err) => PrepareAutomationError::JwtVerify(err),
19 }
20 }
21}
22
23impl From<AutomationScope> for ControllerScope {
24 fn from(scope: AutomationScope) -> Self {
25 match scope {
26 AutomationScope::Write => ControllerScope::Write,
27 AutomationScope::Submit => ControllerScope::Submit,
28 }
29 }
30}