diff options
author | vman <public@vaughnnugent.com> | 2022-12-15 01:41:41 -0500 |
---|---|---|
committer | vman <public@vaughnnugent.com> | 2022-12-15 01:41:41 -0500 |
commit | a5ad943584e91bfbd953dc373a7a313367c7e0ae (patch) | |
tree | 5d5c63f6c04e3e87dec3b8fec3662d39b7b954d0 /VNLib.Plugins.Essentials.Accounts.Registration | |
parent | f13193aa928f099c8152653570d2839b46b8f1ee (diff) |
Mfa/login fixes
Diffstat (limited to 'VNLib.Plugins.Essentials.Accounts.Registration')
-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 |