refactor(auth): move into central auth-engine setup
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:
@@ -14,31 +14,31 @@ pub struct IntrospectionState {
|
||||
|
||||
#[derive(clap::Args, Clone, Debug, PartialEq, Eq)]
|
||||
pub struct IntrospectionConfigClap {
|
||||
#[arg(
|
||||
env = "ZITADEL_AUTHORITY",
|
||||
long = "zitadel-authority",
|
||||
group = "introspection"
|
||||
)]
|
||||
pub authority: String,
|
||||
// #[arg(
|
||||
// env = "ZITADEL_AUTHORITY",
|
||||
// long = "zitadel-authority",
|
||||
// group = "zitadel"
|
||||
// )]
|
||||
pub authority: Option<String>,
|
||||
|
||||
#[arg(
|
||||
env = "ZITADEL_CLIENT_ID",
|
||||
long = "zitadel-client-id",
|
||||
group = "introspection"
|
||||
)]
|
||||
pub client_id: String,
|
||||
#[arg(
|
||||
env = "ZITADEL_CLIENT_SECRET",
|
||||
long = "zitadel-client-secret",
|
||||
group = "introspection"
|
||||
)]
|
||||
pub client_secret: String,
|
||||
// #[arg(
|
||||
// env = "ZITADEL_CLIENT_ID",
|
||||
// long = "zitadel-client-id",
|
||||
// group = "zitadel"
|
||||
// )]
|
||||
pub client_id: Option<String>,
|
||||
// #[arg(
|
||||
// env = "ZITADEL_CLIENT_SECRET",
|
||||
// long = "zitadel-client-secret",
|
||||
// group = "zitadel"
|
||||
// )]
|
||||
pub client_secret: Option<String>,
|
||||
}
|
||||
|
||||
impl IntrospectionConfigClap {
|
||||
async fn try_into(self) -> anyhow::Result<IntrospectionState> {
|
||||
IntrospectionStateBuilder::new(&self.authority)
|
||||
.with_basic_auth(&self.client_id, &self.client_secret)
|
||||
IntrospectionStateBuilder::new(&self.authority.unwrap())
|
||||
.with_basic_auth(&self.client_id.unwrap(), &self.client_secret.unwrap())
|
||||
.build()
|
||||
.await
|
||||
.context("failed to generate an introspection builder")
|
||||
|
Reference in New Issue
Block a user