refactor(auth): setup convenience for OAuth
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
pub use introspection::IntrospectionConfigClap;
|
||||
use oauth::{OAuth, ZitadelConfig};
|
||||
|
||||
mod introspection;
|
||||
mod oauth;
|
||||
@@ -47,7 +48,16 @@ pub struct ZitadelClap {
|
||||
pub token_url: Option<String>,
|
||||
}
|
||||
|
||||
impl AuthClap {}
|
||||
impl TryFrom<AuthClap> for OAuth {
|
||||
type Error = anyhow::Error;
|
||||
|
||||
fn try_from(value: AuthClap) -> Result<Self, Self::Error> {
|
||||
match value.engine {
|
||||
AuthEngine::Noop => Ok(OAuth::new_noop()),
|
||||
AuthEngine::Zitadel => Ok(OAuth::from(ZitadelConfig::try_from(value.zitadel)?)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
|
Reference in New Issue
Block a user