Codeunit 9357 Graph Auth. Client Credentials, source in 24
Source242526272829metadata in 24
src/System Application/App/MicrosoftGraph/src/Authorization/GraphAuthClientCredentials.Codeunit.al46 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.Integration.Graph.Authorization;
using System.RestClient;
codeunit 9357 "Graph Auth. Client Credentials" implements "Graph Authorization"
{
Access = Internal;
InherentEntitlements = X;
InherentPermissions = X;
var
ClientCredentialsTokenAuthorityUrlTxt: Label 'https://login.microsoftonline.com/%1/oauth2/v2.0/token', Comment = '%1 = AAD tenant ID', Locked = true;
[NonDebuggable]
Scopes: List of [Text];
[NonDebuggable]
ClientSecret: SecretText;
[NonDebuggable]
AadTenantId: Text;
[NonDebuggable]
[NonDebuggable]
ClientId: Text;
[NonDebuggable]
procedure SetParameters(NewAadTenantId: Text; NewClientId: Text; NewClientSecret: SecretText; NewScopes: List of [Text])
begin
AadTenantId := NewAadTenantId;
ClientId := NewClientId;
ClientSecret := NewClientSecret;
Scopes := NewScopes;
end;
procedure GetHttpAuthorization(): Interface "Http Authentication"
var
HttpAuthOAuthClientCredentials: Codeunit HttpAuthOAuthClientCredentials;
OAuthAuthorityUrl: Text;
begin
OAuthAuthorityUrl := StrSubstNo(ClientCredentialsTokenAuthorityUrlTxt, AadTenantId);
HttpAuthOAuthClientCredentials.Initialize(OAuthAuthorityUrl, ClientId, ClientSecret, Scopes);
exit(HttpAuthOAuthClientCredentials);
end;
}