From 06514e2929c989cd34f8e074b26006136a749c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szak=C3=A1ts=20Alp=C3=A1r=20Zsolt?= Date: Sun, 17 Aug 2025 00:35:34 +0200 Subject: [PATCH] Refactors Tesla OIDC configuration retrieval Replaces the default document retriever with a custom implementation. This change simplifies the configuration by embedding the HTTP document retriever directly within the custom retriever, and centralizes the URL replacement logic for Tesla's OIDC configuration. This avoids injecting the HttpDocumentRetriever into the TeslaDocumentRetriever constructor and makes the code more maintainable. --- .../Utilities/TeslaOIDCConfigurationManager.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Source/ProofOfConcept/Utilities/TeslaOIDCConfigurationManager.cs b/Source/ProofOfConcept/Utilities/TeslaOIDCConfigurationManager.cs index cb17180..e1aed1d 100644 --- a/Source/ProofOfConcept/Utilities/TeslaOIDCConfigurationManager.cs +++ b/Source/ProofOfConcept/Utilities/TeslaOIDCConfigurationManager.cs @@ -15,7 +15,7 @@ public sealed class TeslaOIDCConfigurationManager : IConfigurationManager(metadataAddress, new OpenIdConnectConfigurationRetriever(), new HttpDocumentRetriever()); + _inner = new ConfigurationManager(metadataAddress, new OpenIdConnectConfigurationRetriever(), new TeslaDocumentRetriever()); } public async Task GetConfigurationAsync(CancellationToken cancel) @@ -37,16 +37,10 @@ public sealed class TeslaOIDCConfigurationManager : IConfigurationManager GetDocumentAsync(string address, CancellationToken cancel) { - address = address.Replace("https://fleet-auth.tesla.com/oauth2/v3", "https://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3"); string document = await this.httpDocumentRetriever.GetDocumentAsync(address, cancel); return document.Replace("https://fleet-auth.tesla.com/oauth2/v3", "https://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3"); }