Codeunit 3803 In Memory Secret Prov Impl. in 26

App
System Application
Namespace
System.Security

Procedures, 3

Versions171819202122232425262728latest

Source242526272829

Source in 26

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;

}

Procedures, 3

NameParametersReturnsAccessObsolete
AddSecret(Text, Text)public-
GetSecret(Text, var Text)Booleanpublic-
GetSecret(Text, var SecretText)Booleanpublic-