aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorrtkay123 <dev@kanjala.com>2026-02-09 10:24:16 +0200
committerrtkay123 <dev@kanjala.com>2026-02-09 10:24:16 +0200
commit253c5631ae09fd5ad9fd6b3eff104e6099d4676c (patch)
tree56096882cd282b4760480a38750f7c70606918d8 /lib
parent9b0c8c23e85930ef1128e73e06713c8a36708625 (diff)
downloadsellershut-253c5631ae09fd5ad9fd6b3eff104e6099d4676c.tar.bz2
sellershut-253c5631ae09fd5ad9fd6b3eff104e6099d4676c.zip
feat: merge config
Diffstat (limited to 'lib')
-rw-r--r--lib/auth-service/src/client/mod.rs22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/auth-service/src/client/mod.rs b/lib/auth-service/src/client/mod.rs
index 25cf16c..af581b0 100644
--- a/lib/auth-service/src/client/mod.rs
+++ b/lib/auth-service/src/client/mod.rs
@@ -22,18 +22,34 @@ pub struct ClientConfig {
auth_url: Url,
}
+impl ClientConfig {
+ pub fn new(
+ client_id: String,
+ client_secret: SecretString,
+ token_url: Url,
+ auth_url: Url,
+ ) -> Self {
+ Self {
+ client_id,
+ client_secret,
+ token_url,
+ auth_url,
+ }
+ }
+}
+
impl TryFrom<ClientConfig> for OauthClient {
type Error = AuthServiceError;
fn try_from(value: ClientConfig) -> Result<Self, Self::Error> {
debug!("creating oauth client");
Ok(Self(
- oauth2::basic::BasicClient::new(ClientId::new(value.client_id))
+ oauth2::basic::BasicClient::new(ClientId::new(value.client_id.to_string()))
.set_client_secret(ClientSecret::new(
value.client_secret.expose_secret().to_string(),
))
- .set_auth_uri(AuthUrl::from_url(value.auth_url))
- .set_token_uri(TokenUrl::from_url(value.token_url)),
+ .set_auth_uri(AuthUrl::from_url(value.auth_url.to_owned()))
+ .set_token_uri(TokenUrl::from_url(value.token_url.to_owned())),
))
}
}