Skip to content

Commit

Permalink
[DI-1340] - ODS API 7.x support. - Add ODS API Connection. (#70)
Browse files Browse the repository at this point in the history
* ODS API 7.x support. - Add ODS API Connection.

* Single tenant. No ODS Context.

* Single Tenant with Ods Context - Initial Progress.

* Single Tenant with Ods Context - In Progress.

* Single Tenant with Ods Context - In Progress.

* Fix tests

* Fix and add tests

* Fix and add tests

* Fix and add tests

* Fix swagger parser

* Some details

* Removing ssl error hacks

* Some details

* Removes unused import

* Removing ssl error hacks 2

* Disable save button when tenant or context change.

* Adding #if DEBUG statement for skipping cert validation.

* Moves constant to constants object
  • Loading branch information
DavidJGapCR authored Apr 25, 2024
1 parent 5bef031 commit db11c3b
Show file tree
Hide file tree
Showing 35 changed files with 234,223 additions and 115 deletions.
5 changes: 5 additions & 0 deletions DataImport.Common/ExtensionMethods/OdsApiVersionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@ public static bool IsOdsV2(this string apiVersion)
{
return apiVersion != null && apiVersion.StartsWith("2.");
}

public static bool IsOdsV3(this string apiVersion)
{
return apiVersion != null && apiVersion.StartsWith("7.");
}
}
}
14 changes: 13 additions & 1 deletion DataImport.Common/Helpers/OAuthRequestWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,19 @@ public string GetBearerToken(ApiServer apiServer, string encryptionKey)
public string GetBearerToken(ApiServer apiServer, string encryptionKey, string accessCode)
{
var tokenUrl = new Uri(apiServer.TokenUrl);
var oauthClient = new RestClient(tokenUrl.GetLeftPart(UriPartial.Authority));

#if DEBUG
#pragma warning disable S4830
var options = new RestClientOptions(tokenUrl.GetLeftPart(UriPartial.Authority))
{
RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true
};
#pragma warning restore S4830
#else
var options = new RestClientOptions(tokenUrl.GetLeftPart(UriPartial.Authority));
#endif

var oauthClient = new RestClient(options);

var bearerTokenRequest = new RestRequest(tokenUrl.AbsolutePath, Method.Post);

Expand Down
6 changes: 6 additions & 0 deletions DataImport.Models/ApiServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public class ApiServer : Entity

public ApiVersion ApiVersion { get; set; }

[MaxLength(255)]
public string Tenant { get; set; }

[MaxLength(255)]
public string Context { get; set; }

public ICollection<BootstrapDataApiServer> BootstrapDataApiServers { get; set; }
}
}
Loading

0 comments on commit db11c3b

Please sign in to comment.