Skip to content

Commit

Permalink
- Add AccessToken property to GXLocation. (#875)
Browse files Browse the repository at this point in the history
* - Add AccessToken property to GXLocation.

* - Fix spelling of property
  • Loading branch information
AlejandroP authored Oct 5, 2023
1 parent 692396a commit 8457795
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dotnet/src/dotnetframework/GxClasses/Domain/GxLocations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class GxLocation
string _resourceName = "";
short _authentication;
short _authenticationMethod;
string _accessToken = "";
string _authenticationUser = "";
string _authenticationRealm = "";
string _authenticationPassword = "";
Expand Down Expand Up @@ -76,6 +77,11 @@ public short AuthenticationMethod
get {return _authenticationMethod;}
set {_authenticationMethod = value;}
}
public string AccessToken
{
get { return _accessToken; }
set { _accessToken = value; }
}
public string AuthenticationUser
{
get {return _authenticationUser;}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ public void RestExecute()
httpClient.AddHeader("Content-Type", _contentType);
}
}
if (this.Location.AuthenticationMethod == 4 && !String.IsNullOrEmpty(this.Location.AccessToken))
{
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;
serviceuri += "/" + this.Location.BaseUrl.TrimEnd('/').TrimStart('/') + "/" + this.Location.ResourceName;
Expand Down

0 comments on commit 8457795

Please sign in to comment.