diff options
Diffstat (limited to 'VNLib.Plugins.Essentials.Accounts.Registration/src')
-rw-r--r-- | VNLib.Plugins.Essentials.Accounts.Registration/src/EmailSystemConfig.cs | 13 | ||||
-rw-r--r-- | VNLib.Plugins.Essentials.Accounts.Registration/src/Endpoints/RegistrationEntpoint.cs | 5 |
2 files changed, 11 insertions, 7 deletions
diff --git a/VNLib.Plugins.Essentials.Accounts.Registration/src/EmailSystemConfig.cs b/VNLib.Plugins.Essentials.Accounts.Registration/src/EmailSystemConfig.cs index 56c7f37..238ae37 100644 --- a/VNLib.Plugins.Essentials.Accounts.Registration/src/EmailSystemConfig.cs +++ b/VNLib.Plugins.Essentials.Accounts.Registration/src/EmailSystemConfig.cs @@ -65,17 +65,18 @@ namespace VNLib.Plugins.Essentials.Accounts.Registration //Load oauth secrets from vault - Task<string?> oauth2ClientID = pbase.TryGetSecretAsync("oauth2_client_id"); - Task<string?> oauth2Password = pbase.TryGetSecretAsync("oauth2_client_secret"); + Task<SecretResult?> oauth2ClientID = pbase.TryGetSecretAsync("oauth2_client_id"); + Task<SecretResult?> oauth2Password = pbase.TryGetSecretAsync("oauth2_client_secret"); //Lazy cred loaded, tasks should be loaded before this method will ever get called Credential lazyCredentialGet() { //Load the results - string cliendId = oauth2ClientID.Result ?? throw new KeyNotFoundException("Missing required oauth2 client id"); - string password = oauth2Password.Result ?? throw new KeyNotFoundException("Missing required oauth2 client secret"); + SecretResult cliendId = oauth2ClientID.Result ?? throw new KeyNotFoundException("Missing required oauth2 client id"); + SecretResult password = oauth2Password.Result ?? throw new KeyNotFoundException("Missing required oauth2 client secret"); - return Credential.Create(cliendId, password); + //Creat credential + return Credential.Create(cliendId.Result, password.Result); } @@ -113,6 +114,8 @@ namespace VNLib.Plugins.Essentials.Accounts.Registration { authenticator.Dispose(); RestClientPool.Dispose(); + oauth2ClientID.Dispose(); + oauth2Password.Dispose(); } //register password cleanup diff --git a/VNLib.Plugins.Essentials.Accounts.Registration/src/Endpoints/RegistrationEntpoint.cs b/VNLib.Plugins.Essentials.Accounts.Registration/src/Endpoints/RegistrationEntpoint.cs index 1e983cb..b56cb3c 100644 --- a/VNLib.Plugins.Essentials.Accounts.Registration/src/Endpoints/RegistrationEntpoint.cs +++ b/VNLib.Plugins.Essentials.Accounts.Registration/src/Endpoints/RegistrationEntpoint.cs @@ -100,8 +100,9 @@ namespace VNLib.Plugins.Essentials.Accounts.Registration.Endpoints //Begin the async op to get the signature key from the vault RegSignatureKey = plugin.TryGetSecretAsync("reg_sig_key").ContinueWith((ts) => { - _ = ts.Result ?? throw new KeyNotFoundException("Missing required key 'reg_sig_key' in 'registration' configuration"); - return Convert.FromBase64String(ts.Result); + using SecretResult? sr = ts.Result ?? throw new KeyNotFoundException("Missing required key 'reg_sig_key' in 'registration' configuration"); + return ts.Result.GetFromBase64(); + }, TaskScheduler.Default); //Register timeout for cleanup |