mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-08 18:31:36 +01:00
Promote security knowledge from community to Microsoft layer
Pure git-mv relocation of the SECURITY domain from the community layer to the Microsoft layer. No content changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
3769d2fbf4
commit
347984ac74
16 changed files with 0 additions and 0 deletions
|
|
@ -1,44 +0,0 @@
|
|||
codeunit 50100 "Partner API Client"
|
||||
{
|
||||
procedure FetchOrders(var Response: Text): Boolean
|
||||
var
|
||||
OAuth2: Codeunit OAuth2;
|
||||
HttpClient: HttpClient;
|
||||
HttpRequest: HttpRequestMessage;
|
||||
HttpResponse: HttpResponseMessage;
|
||||
AccessToken: SecretText;
|
||||
Scopes: List of [Text];
|
||||
begin
|
||||
Scopes.Add('https://partner.example.com/.default');
|
||||
|
||||
// Client-credentials flow for service-to-service. Tokens expire and rotate
|
||||
// on their own schedule; secret and client id are retrieved from IsolatedStorage.
|
||||
if not OAuth2.AcquireTokenWithClientCredentials(
|
||||
GetClientIdFromIsolatedStorage(),
|
||||
GetClientSecretFromIsolatedStorage(),
|
||||
'https://login.example.com/tenantid/oauth2/v2.0/token',
|
||||
'',
|
||||
Scopes,
|
||||
AccessToken)
|
||||
then
|
||||
exit(false);
|
||||
|
||||
HttpRequest.SetRequestUri('https://partner.example.com/orders');
|
||||
HttpRequest.Method('GET');
|
||||
HttpRequest.GetHeaders().Add('Authorization', SecretStrSubstNo('Bearer %1', AccessToken));
|
||||
|
||||
if not HttpClient.Send(HttpRequest, HttpResponse) then
|
||||
exit(false);
|
||||
|
||||
HttpResponse.Content.ReadAs(Response);
|
||||
exit(HttpResponse.IsSuccessStatusCode);
|
||||
end;
|
||||
|
||||
local procedure GetClientIdFromIsolatedStorage(): Text
|
||||
begin
|
||||
end;
|
||||
|
||||
local procedure GetClientSecretFromIsolatedStorage(): SecretText
|
||||
begin
|
||||
end;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue