Codeunit 9063 Stor. Serv. Auth. Impl.

App
System Application
Namespace
System.Azure.Storage
Versions
19-28

Procedures, 9

Versions171819202122232425262728

Source242526272829

Source in 29

src/System Application/App/Azure Storage Services Authorization/src/StorServAuthImpl.Codeunit.al69 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.Azure.Storage;

codeunit 9063 "Stor. Serv. Auth. Impl."
{
    Access = Internal;
    InherentEntitlements = X;
    InherentPermissions = X;

    procedure CreateSAS(SigningKey: SecretText; SignedVersion: Enum "Storage Service API Version"; SignedServices: List of [Enum "SAS Service Type"]; SignedResources: List of [Enum "SAS Resource Type"]; SignedPermissions: List of [Enum "SAS Permission"]; SignedExpiry: DateTime): Interface "Storage Service Authorization"
    var
        TempOptionalParams: Record "SAS Parameters";
    begin
        TempOptionalParams.Init();
        exit(CreateSAS(SigningKey, SignedVersion, SignedServices, SignedResources, SignedPermissions, SignedExpiry, TempOptionalParams));
    end;

    procedure CreateSAS(SigningKey: SecretText; SignedVersion: Enum "Storage Service API Version"; SignedServices: List of [Enum "SAS Service Type"]; SignedResources: List of [Enum "SAS Resource Type"]; SignedPermissions: List of [Enum "SAS Permission"]; SignedExpiry: DateTime; OptionalParams: Record "SAS Parameters"): Interface "Storage Service Authorization"
    var
        StorServAuthSAS: Codeunit "Stor. Serv. Auth. SAS";
    begin
        StorServAuthSAS.SetSigningKey(SigningKey);
        StorServAuthSAS.SetVersion(SignedVersion);
        StorServAuthSAS.SetSignedServices(SignedServices);
        StorServAuthSAS.SetResources(SignedResources);
        StorServAuthSAS.SetSignedPermissions(SignedPermissions);
        StorServAuthSAS.SetSignedExpiry(SignedExpiry);

        // Set optional parameters
        if OptionalParams.SignedStart <> 0DT then
          StorServAuthSAS.SetSignedStart(OptionalParams.SignedStart)
        else
          StorServAuthSAS.SetSignedStart(CurrentDateTime());
        StorServAuthSAS.SetIPrange(OptionalParams.SignedIp);
        StorServAuthSAS.SetProtocol(OptionalParams.SignedProtocol);
        StorServAuthSAS.SetSignedEncryptionScope(OptionalParams.SignedEncryptionScope);

        exit(StorServAuthSAS);
    end;

    procedure SharedKey(SharedKeyToUse: SecretText; ApiVersion: Enum "Storage Service API Version"): Interface "Storage Service Authorization"
    var
        StorServAuthSharedKey: Codeunit "Stor. Serv. Auth. Shared Key";
    begin
        StorServAuthSharedKey.SetSharedKey(SharedKeyToUse);
        StorServAuthSharedKey.SetApiVersion(ApiVersion);

        exit(StorServAuthSharedKey);
    end;

    procedure ReadySAS(SASToken: SecretText): Interface "Storage Service Authorization"
    var
        StorServAuthReadySAS: Codeunit "Stor. Serv. Auth. Ready SAS";
    begin
        StorServAuthReadySAS.SetSharedAccessSignature(SASToken);

        exit(StorServAuthReadySAS);
    end;

    procedure GetDefaultAPIVersion(): Enum "Storage Service API Version"
    begin
        exit(Enum::"Storage Service API Version"::"2020-10-02");
    end;
}