Skip to content

Commit 8457795

Browse files
authored
- Add AccessToken property to GXLocation. (#875)
* - Add AccessToken property to GXLocation. * - Fix spelling of property
1 parent 692396a commit 8457795

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class GxLocation
1616
string _resourceName = "";
1717
short _authentication;
1818
short _authenticationMethod;
19+
string _accessToken = "";
1920
string _authenticationUser = "";
2021
string _authenticationRealm = "";
2122
string _authenticationPassword = "";
@@ -76,6 +77,11 @@ public short AuthenticationMethod
7677
get {return _authenticationMethod;}
7778
set {_authenticationMethod = value;}
7879
}
80+
public string AccessToken
81+
{
82+
get { return _accessToken; }
83+
set { _accessToken = value; }
84+
}
7985
public string AuthenticationUser
8086
{
8187
get {return _authenticationUser;}

dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@ public void RestExecute()
371371
httpClient.AddHeader("Content-Type", _contentType);
372372
}
373373
}
374+
if (this.Location.AuthenticationMethod == 4 && !String.IsNullOrEmpty(this.Location.AccessToken))
375+
{
376+
httpClient.AddHeader("Authorization", this.Location.AccessToken);
377+
}
374378
string serviceuri = ((this.Location.Secure > 0) ? "https" : "http") + "://" + this.Location.Host;
375379
serviceuri += (this.Location.Port != 80) ? ":" + this.Location.Port.ToString() : String.Empty;
376380
serviceuri += "/" + this.Location.BaseUrl.TrimEnd('/').TrimStart('/') + "/" + this.Location.ResourceName;

0 commit comments

Comments
 (0)