Codeunit 3803 In Memory Secret Prov Impl.
- App
- System Application
- Namespace
- System.Security
- Versions
- 17-28
Versions171819202122232425262728
Source in 29
src/System Application/App/Secrets/src/InMemorySecretProvImpl.Codeunit.al53 lines, Copyright (c) Microsoft Corporation. MIT
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace System.Security;
/// <summary>
/// An in-memory secret provider that can be populated with secrets from any source.
/// </summary>
codeunit 3803 "In Memory Secret Prov Impl."
{
Access = Internal;
InherentEntitlements = X;
InherentPermissions = X;
var
[NonDebuggable]
dict: Dictionary of [Text, Text];
[NonDebuggable]
procedure AddSecret(SecretName: Text; SecretValue: Text)
begin
if dict.ContainsKey(SecretName) then
dict.Remove(SecretName);
dict.Add(SecretName, SecretValue);
end;
[NonDebuggable]
procedure GetSecret(SecretName: Text; var SecretValue: Text): Boolean
begin
if dict.ContainsKey(SecretName) then begin
dict.Get(SecretName, SecretValue);
exit(true);
end;
exit(false);
end;
[NonDebuggable]
procedure GetSecret(SecretName: Text; var SecretValue: SecretText): Boolean
var
SecretValueText: Text;
begin
if not GetSecret(SecretName, SecretValueText) then
exit(false);
SecretValue := SecretValueText;
exit(true);
end;
}