Introduced UrlCombine to properly join urls.
This commit is contained in:
Tomek Melissa 2020-05-05 12:18:18 +02:00
Родитель d49349afa7
Коммит 796ee22b03
18 изменённых файлов: 31 добавлений и 30 удалений

Просмотреть файл

@ -90,13 +90,13 @@
<Version>2.0.8</Version>
</PackageReference>
<PackageReference Include="Microsoft.Identity.Client">
<Version>4.10.0</Version>
<Version>4.13.0</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="Polly">
<Version>7.2.0</Version>
<Version>7.2.1</Version>
</PackageReference>
<PackageReference Include="Quartz">
<Version>3.0.7</Version>
@ -104,6 +104,9 @@
<PackageReference Include="System.Linq.Dynamic">
<Version>1.0.7</Version>
</PackageReference>
<PackageReference Include="UrlCombine">
<Version>2.0.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

Просмотреть файл

@ -7,6 +7,7 @@ using System;
using System.Linq;
using System.Security;
using System.Threading.Tasks;
using UrlCombineLib;
namespace RecurringIntegrationsScheduler.Common.Helpers
{
@ -17,7 +18,6 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
{
private readonly Settings _settings;
private string _authorizationHeader;
private const string AuthEndpoint = "https://login.microsoftonline.com/";
/// <summary>
/// Initializes a new instance of the <see cref="AuthenticationHelper"/> class.
@ -49,7 +49,7 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
IConfidentialClientApplication appConfidential;
IPublicClientApplication appPublic;
var aosUriAuthUri = new Uri(_settings.AosUri);
string authority = AuthEndpoint + _settings.AadTenant;
string authority = UrlCombine.Combine(_settings.AzureAuthEndpoint, _settings.AadTenant);
string[] scopes = new string[] { aosUriAuthUri.AbsoluteUri + ".default" };
if (_settings.UseServiceAuthentication)

Просмотреть файл

@ -15,6 +15,7 @@ using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using UrlCombineLib;
namespace RecurringIntegrationsScheduler.Common.Helpers
{
@ -186,7 +187,7 @@ addAuthorization: {addAuthorization}");
public Uri GetEnqueueUri(string legalEntity = null)
{
var uploadSettings = _settings as UploadJobSettings;
var enqueueUri = new UriBuilder(GetAosRequestUri(ConnectorApiActions.EnqueuePath + uploadSettings.ActivityId));
var enqueueUri = new UriBuilder(GetAosRequestUri(UrlCombine.Combine(ConnectorApiActions.EnqueuePath, uploadSettings.ActivityId.ToString())));
var query = HttpUtility.ParseQueryString(enqueueUri.Query);
if (!string.IsNullOrEmpty(legalEntity))
@ -231,7 +232,7 @@ Generated query: {enqueueUri.Query}");
public Uri GetDequeueUri()
{
var downloadSettings = _settings as DownloadJobSettings;
var dequeueUri = new UriBuilder(GetAosRequestUri(ConnectorApiActions.DequeuePath + downloadSettings.ActivityId)).Uri;
var dequeueUri = new UriBuilder(GetAosRequestUri(UrlCombine.Combine(ConnectorApiActions.DequeuePath, downloadSettings.ActivityId.ToString()))).Uri;
if (_settings.LogVerbose || Log.IsDebugEnabled)
{
Log.Debug($@"Job: {_settings.JobKey}. HttpClientHelper.GetDequeueUri is being called.
@ -251,7 +252,7 @@ Generated Uri: {dequeueUri.AbsoluteUri}");
public Uri GetAckUri()
{
var downloadSettings = _settings as DownloadJobSettings;
var ackUri = new UriBuilder(GetAosRequestUri(ConnectorApiActions.AckPath + downloadSettings.ActivityId)).Uri;
var ackUri = new UriBuilder(GetAosRequestUri(UrlCombine.Combine(ConnectorApiActions.AckPath, downloadSettings.ActivityId.ToString()))).Uri;
if (_settings.LogVerbose || Log.IsDebugEnabled)
{
Log.Debug($@"Job: {_settings.JobKey}. HttpClientHelper.GetAckUri is being called.
@ -272,7 +273,7 @@ Generated Uri: {ackUri.AbsoluteUri}");
public Uri GetJobStatusUri(string jobId)
{
var processingJobSettings = _settings as ProcessingJobSettings;
var jobStatusUri = new UriBuilder(GetAosRequestUri(ConnectorApiActions.JobStatusPath + processingJobSettings.ActivityId))
var jobStatusUri = new UriBuilder(GetAosRequestUri(UrlCombine.Combine(ConnectorApiActions.JobStatusPath, processingJobSettings.ActivityId.ToString())))
{
Query = "jobId=" + jobId.Replace(@"""", "")
};
@ -842,13 +843,10 @@ Response message: {response.Content}");
}
private Uri GetAosRequestUri(string requestRelativePath)
{
var aosUri = new Uri(_settings.AosUri);
var builder = new UriBuilder(aosUri)
{
Path = string.Concat(aosUri.AbsolutePath.TrimEnd('/'), "/", requestRelativePath.TrimStart('/'))
};
return builder.Uri;
{
var aosUrl = UrlCombine.Combine(_settings.AosUri, requestRelativePath);
var aosUri = new Uri(aosUrl);
return aosUri;
}
public static string ReadResponseString(HttpResponseMessage response)

Просмотреть файл

@ -45,7 +45,7 @@
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Polly, Version=7.0.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc, processorArchitecture=MSIL">
<HintPath>..\packages\Polly.7.2.0\lib\net472\Polly.dll</HintPath>
<HintPath>..\packages\Polly.7.2.1\lib\net472\Polly.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.0.7\lib\net452\Quartz.dll</HintPath>

Просмотреть файл

@ -2,6 +2,6 @@
<packages>
<package id="log4net" version="2.0.8" targetFramework="net46" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
<package id="Polly" version="7.2.0" targetFramework="net472" />
<package id="Polly" version="7.2.1" targetFramework="net472" />
<package id="Quartz" version="3.0.7" targetFramework="net461" />
</packages>

Просмотреть файл

@ -45,7 +45,7 @@
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Polly, Version=7.0.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc, processorArchitecture=MSIL">
<HintPath>..\packages\Polly.7.2.0\lib\net472\Polly.dll</HintPath>
<HintPath>..\packages\Polly.7.2.1\lib\net472\Polly.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.0.7\lib\net452\Quartz.dll</HintPath>

Просмотреть файл

@ -2,6 +2,6 @@
<packages>
<package id="log4net" version="2.0.8" targetFramework="net46" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
<package id="Polly" version="7.2.0" targetFramework="net472" />
<package id="Polly" version="7.2.1" targetFramework="net472" />
<package id="Quartz" version="3.0.7" targetFramework="net461" />
</packages>

Просмотреть файл

@ -42,7 +42,7 @@
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Polly, Version=7.0.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc, processorArchitecture=MSIL">
<HintPath>..\packages\Polly.7.2.0\lib\net472\Polly.dll</HintPath>
<HintPath>..\packages\Polly.7.2.1\lib\net472\Polly.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.0.7\lib\net452\Quartz.dll</HintPath>

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.8" targetFramework="net46" />
<package id="Polly" version="7.2.0" targetFramework="net472" />
<package id="Polly" version="7.2.1" targetFramework="net472" />
<package id="Quartz" version="3.0.7" targetFramework="net461" />
</packages>

Просмотреть файл

@ -45,7 +45,7 @@
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Polly, Version=7.0.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc, processorArchitecture=MSIL">
<HintPath>..\packages\Polly.7.2.0\lib\net472\Polly.dll</HintPath>
<HintPath>..\packages\Polly.7.2.1\lib\net472\Polly.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.0.7\lib\net452\Quartz.dll</HintPath>

Просмотреть файл

@ -2,6 +2,6 @@
<packages>
<package id="log4net" version="2.0.8" targetFramework="net46" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
<package id="Polly" version="7.2.0" targetFramework="net472" />
<package id="Polly" version="7.2.1" targetFramework="net472" />
<package id="Quartz" version="3.0.7" targetFramework="net461" />
</packages>

Просмотреть файл

@ -45,7 +45,7 @@
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Polly, Version=7.0.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc, processorArchitecture=MSIL">
<HintPath>..\packages\Polly.7.2.0\lib\net472\Polly.dll</HintPath>
<HintPath>..\packages\Polly.7.2.1\lib\net472\Polly.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.0.7\lib\net452\Quartz.dll</HintPath>

Просмотреть файл

@ -2,6 +2,6 @@
<packages>
<package id="log4net" version="2.0.8" targetFramework="net46" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
<package id="Polly" version="7.2.0" targetFramework="net472" />
<package id="Polly" version="7.2.1" targetFramework="net472" />
<package id="Quartz" version="3.0.7" targetFramework="net461" />
</packages>

Просмотреть файл

@ -42,7 +42,7 @@
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Polly, Version=7.0.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc, processorArchitecture=MSIL">
<HintPath>..\packages\Polly.7.2.0\lib\net472\Polly.dll</HintPath>
<HintPath>..\packages\Polly.7.2.1\lib\net472\Polly.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.0.7\lib\net452\Quartz.dll</HintPath>

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.8" targetFramework="net46" />
<package id="Polly" version="7.2.0" targetFramework="net472" />
<package id="Polly" version="7.2.1" targetFramework="net472" />
<package id="Quartz" version="3.0.7" targetFramework="net461" />
</packages>

Просмотреть файл

@ -69,7 +69,7 @@
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Polly, Version=7.0.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc, processorArchitecture=MSIL">
<HintPath>..\packages\Polly.7.2.0\lib\net472\Polly.dll</HintPath>
<HintPath>..\packages\Polly.7.2.1\lib\net472\Polly.dll</HintPath>
</Reference>
<Reference Include="PortableSettingsProvider, Version=0.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\PortableSettingsProvider.0.2.3\lib\net45\PortableSettingsProvider.dll</HintPath>

Просмотреть файл

@ -2,7 +2,7 @@
<packages>
<package id="log4net" version="2.0.8" targetFramework="net46" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
<package id="Polly" version="7.2.0" targetFramework="net472" />
<package id="Polly" version="7.2.1" targetFramework="net472" />
<package id="PortableSettingsProvider" version="0.2.3" targetFramework="net472" />
<package id="Quartz" version="3.0.7" targetFramework="net461" />
<package id="Quartz.Jobs" version="3.0.7" targetFramework="net472" />

Просмотреть файл

@ -2,4 +2,4 @@
Licensed under the MIT License. */
using System.Reflection;
[assembly: AssemblyVersion("3.1.2.0")]
[assembly: AssemblyVersion("3.1.3.0")]