From dfd97c758767c847adcffd76eb836cdc57c89a11 Mon Sep 17 00:00:00 2001 From: AlejandroP Date: Mon, 18 Sep 2023 23:15:40 -0300 Subject: [PATCH 1/2] Cherry pick branch 'genexuslabs:location_token' into beta --- dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs | 6 ++++++ .../dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs b/dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs index e8b2bc1eb..0f8fe42fa 100644 --- a/dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs +++ b/dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs @@ -16,6 +16,7 @@ public class GxLocation string _resourceName = ""; short _authentication; short _authenticationMethod; + string _accessToken = ""; string _authenticationUser = ""; string _authenticationRealm = ""; string _authenticationPassword = ""; @@ -76,6 +77,11 @@ public short AuthenticationMethod get {return _authenticationMethod;} set {_authenticationMethod = value;} } + public string AcessToken + { + get { return _accessToken; } + set { _accessToken = value; } + } public string AuthenticationUser { get {return _authenticationUser;} diff --git a/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs b/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs index 6cc2ff359..5b4777d35 100644 --- a/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs +++ b/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs @@ -371,6 +371,10 @@ public void RestExecute() httpClient.AddHeader("Content-Type", _contentType); } } + if (this.Location.AuthenticationMethod == 4 && !String.IsNullOrEmpty(this.Location.AcessToken)) + { + httpClient.AddHeader("Authorization", this.Location.AcessToken); + } string serviceuri = ((this.Location.Secure > 0) ? "https" : "http") + "://" + this.Location.Host; serviceuri += (this.Location.Port != 80) ? ":" + this.Location.Port.ToString() : String.Empty; serviceuri += "/" + this.Location.BaseUrl.TrimEnd('/').TrimStart('/') + "/" + this.Location.ResourceName; From a8728115835380df57d8e329954d405b85c8974f Mon Sep 17 00:00:00 2001 From: AlejandroP Date: Tue, 19 Sep 2023 10:59:41 -0300 Subject: [PATCH 2/2] Cherry pick branch 'genexuslabs:location_token' into beta --- dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs | 2 +- .../src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs b/dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs index 0f8fe42fa..8ef8be5b2 100644 --- a/dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs +++ b/dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs @@ -77,7 +77,7 @@ public short AuthenticationMethod get {return _authenticationMethod;} set {_authenticationMethod = value;} } - public string AcessToken + public string AccessToken { get { return _accessToken; } set { _accessToken = value; } diff --git a/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs b/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs index 5b4777d35..bc372fc0b 100644 --- a/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs +++ b/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs @@ -371,9 +371,9 @@ public void RestExecute() httpClient.AddHeader("Content-Type", _contentType); } } - if (this.Location.AuthenticationMethod == 4 && !String.IsNullOrEmpty(this.Location.AcessToken)) + if (this.Location.AuthenticationMethod == 4 && !String.IsNullOrEmpty(this.Location.AccessToken)) { - httpClient.AddHeader("Authorization", this.Location.AcessToken); + httpClient.AddHeader("Authorization", this.Location.AccessToken); } string serviceuri = ((this.Location.Secure > 0) ? "https" : "http") + "://" + this.Location.Host; serviceuri += (this.Location.Port != 80) ? ":" + this.Location.Port.ToString() : String.Empty;