use std::fmt;
#[derive(Clone)]
#[allow(dead_code)] pub struct IssueConfig {
pub(crate) issuer: String,
pub(crate) audiences: Vec<String>,
pub(crate) typ: &'static str,
pub(crate) kid: String,
pub(crate) cat: &'static str,
}
impl IssueConfig {
pub fn access_token(
issuer: impl Into<String>,
audience: impl Into<String>,
kid: impl Into<String>,
) -> Self {
Self {
issuer: issuer.into(),
audiences: vec![audience.into()],
typ: "at+jwt",
kid: kid.into(),
cat: "access",
}
}
#[must_use]
pub fn with_audiences(mut self, audiences: Vec<String>) -> Self {
self.audiences = audiences;
self
}
}
impl fmt::Debug for IssueConfig {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("IssueConfig")
.field("issuer", &self.issuer)
.field("audiences", &self.audiences)
.field("typ", &self.typ)
.field("kid", &self.kid)
.field("cat", &self.cat)
.finish()
}
}