Skip to content

Commit 89698ab

Browse files
committed
Remove AuthorizationEndpoint property and update authorization controllers for V8
1 parent ce6846c commit 89698ab

File tree

15 files changed

+72
-53
lines changed

15 files changed

+72
-53
lines changed

src/Umbraco.Cms.Integrations.Commerce.Shopify/Configuration/ShopifyOAuthSettings.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ public ShopifyOAuthSettings(NameValueCollection appSettings)
1616

1717
Scopes = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCommerceShopifyScopesKey];
1818

19-
//AuthorizationEndpoint = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCommerceShopifyAuthorizationEndpointKey];
20-
2119
TokenEndpoint = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCommerceShopifyTokenEndpointKey];
2220
}
2321

@@ -29,8 +27,6 @@ public ShopifyOAuthSettings(NameValueCollection appSettings)
2927

3028
public string Scopes { get; set; }
3129

32-
//public string AuthorizationEndpoint { get; set; }
33-
3430
public string TokenEndpoint { get; set; }
3531
}
3632
}

src/Umbraco.Cms.Integrations.Commerce.Shopify/Constants.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ public static class Configuration
4242

4343
public const string UmbracoCmsIntegrationsCommerceShopifyScopesKey = "Umbraco.Cms.Integrations.Commerce.Shopify.Scopes";
4444

45-
public const string UmbracoCmsIntegrationsCommerceShopifyAuthorizationEndpointKey = "Umbraco.Cms.Integrations.Commerce.Shopify.AuthorizationEndpoint";
46-
4745
public const string UmbracoCmsIntegrationsCommerceShopifyTokenEndpointKey = "Umbraco.Cms.Integrations.Commerce.Shopify.TokenEndpoint";
4846
}
4947

src/Umbraco.Cms.Integrations.Commerce.Shopify/Controllers/ShopifyAuthorizationController.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66
using Umbraco.Cms.Web.Common.Controllers;
77
#else
8-
using System.Web.Mvc;
9-
using System.Configuration;
8+
using System.Web.Http;
9+
using System.Net.Http;
10+
using System.Net.Http.Headers;
1011

1112
using Umbraco.Web.WebApi;
1213
#endif
@@ -18,9 +19,6 @@ public class ShopifyAuthorizationController : UmbracoApiController
1819
[HttpGet]
1920
#if NETCOREAPP
2021
public IActionResult OAuth(string code)
21-
#else
22-
public ActionResult OAuth(string code)
23-
#endif
2422
{
2523
return new ContentResult
2624
{
@@ -30,5 +28,16 @@ public ActionResult OAuth(string code)
3028
ContentType = "text/html"
3129
};
3230
}
31+
#else
32+
public HttpResponseMessage OAuth(string code)
33+
{
34+
var response = new HttpResponseMessage();
35+
response.Content = new StringContent(string.IsNullOrEmpty(code)
36+
? JavascriptResponse.Fail("Authorization process failed.")
37+
: JavascriptResponse.Ok(code));
38+
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
39+
return response;
40+
}
41+
#endif
3342
}
3443
}

src/Umbraco.Cms.Integrations.Crm.Dynamics/Configuration/DynamicsOAuthSettings.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ public DynamicsOAuthSettings(NameValueCollection appSettings)
1717

1818
Scopes = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCrmDynamicsScopesKey];
1919

20-
AuthorizationEndpoint = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCrmDynamicsAuthorizationEndpointKey];
21-
2220
TokenEndpoint = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCrmDynamicsTokenEndpointKey];
2321
}
2422

@@ -30,8 +28,6 @@ public DynamicsOAuthSettings(NameValueCollection appSettings)
3028

3129
public string Scopes { get; set; }
3230

33-
public string AuthorizationEndpoint { get; set; }
34-
3531
public string TokenEndpoint { get; set; }
3632
}
3733
}

src/Umbraco.Cms.Integrations.Crm.Dynamics/Constants.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ public static class Configuration
5454

5555
public const string UmbracoCmsIntegrationsCrmDynamicsScopesKey = "Umbraco.Cms.Integrations.Crm.Dynamics.Scopes";
5656

57-
public const string UmbracoCmsIntegrationsCrmDynamicsAuthorizationEndpointKey = "Umbraco.Cms.Integrations.Crm.Dynamics.AuthorizationEndpoint";
58-
5957
public const string UmbracoCmsIntegrationsCrmDynamicsTokenEndpointKey = "Umbraco.Cms.Integrations.Crm.Dynamics.TokenEndpoint";
6058
}
6159
}

src/Umbraco.Cms.Integrations.Crm.Dynamics/Controllers/DynamicsAuthorizationController.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66
using Umbraco.Cms.Web.Common.Controllers;
77
#else
8-
using System.Web.Mvc;
9-
using System.Configuration;
8+
using System.Web.Http;
9+
using System.Net.Http;
10+
using System.Net.Http.Headers;
1011

1112
using Umbraco.Web.WebApi;
1213
#endif
@@ -18,9 +19,6 @@ public class DynamicsAuthorizationController : UmbracoApiController
1819
[HttpGet]
1920
#if NETCOREAPP
2021
public IActionResult OAuth(string code)
21-
#else
22-
public ActionResult OAuth(string code)
23-
#endif
2422
{
2523
return new ContentResult
2624
{
@@ -30,5 +28,17 @@ public ActionResult OAuth(string code)
3028
ContentType = "text/html"
3129
};
3230
}
31+
#else
32+
public HttpResponseMessage OAuth(string code)
33+
{
34+
var response = new HttpResponseMessage();
35+
response.Content = new StringContent(string.IsNullOrEmpty(code)
36+
? JavascriptResponse.Fail("Authorization process failed.")
37+
: JavascriptResponse.Ok(code));
38+
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
39+
return response;
40+
}
41+
#endif
42+
3343
}
3444
}

src/Umbraco.Cms.Integrations.Crm.Hubspot/Configuration/HubspotOAuthSettings.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ public HubspotOAuthSettings(NameValueCollection appSettings)
1616

1717
Scopes = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCrmHubspotScopesKey];
1818

19-
AuthorizationEndpoint = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCrmHubspotAuthorizationEndpointKey];
20-
2119
TokenEndpoint = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCrmHubspotTokenEndpointKey];
2220
}
2321

@@ -29,8 +27,6 @@ public HubspotOAuthSettings(NameValueCollection appSettings)
2927

3028
public string Scopes { get; set; }
3129

32-
public string AuthorizationEndpoint { get; set; }
33-
3430
public string TokenEndpoint { get; set; }
3531
}
3632
}

src/Umbraco.Cms.Integrations.Crm.Hubspot/Constants.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ public static class Configuration
3333

3434
public const string UmbracoCmsIntegrationsCrmHubspotScopesKey = "Umbraco.Cms.Integrations.Crm.Hubspot.Scopes";
3535

36-
public const string UmbracoCmsIntegrationsCrmHubspotAuthorizationEndpointKey = "Umbraco.Cms.Integrations.Crm.Hubspot.AuthorizationEndpoint";
37-
3836
public const string UmbracoCmsIntegrationsCrmHubspotTokenEndpointKey = "Umbraco.Cms.Integrations.Crm.Hubspot.TokenEndpoint";
3937
}
4038

src/Umbraco.Cms.Integrations.Crm.Hubspot/Controllers/HubspotAuthorizationController.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
using Umbraco.Cms.Web.Common.Controllers;
77
#else
8-
using System.Web.Mvc;
8+
using System.Web.Http;
9+
using System.Net.Http;
10+
using System.Net.Http.Headers;
911

1012
using Umbraco.Web.WebApi;
1113
#endif
@@ -17,10 +19,7 @@ public class HubspotAuthorizationController : UmbracoApiController
1719
[HttpGet]
1820
#if NETCOREAPP
1921
public IActionResult OAuth(string code)
20-
#else
21-
public ActionResult OAuth(string code)
22-
#endif
23-
{
22+
{
2423
return new ContentResult
2524
{
2625
Content = string.IsNullOrEmpty(code)
@@ -29,5 +28,16 @@ public ActionResult OAuth(string code)
2928
ContentType = "text/html"
3029
};
3130
}
31+
#else
32+
public HttpResponseMessage OAuth(string code)
33+
{
34+
var response = new HttpResponseMessage();
35+
response.Content = new StringContent(string.IsNullOrEmpty(code)
36+
? JavascriptResponse.Fail("Authorization process failed.")
37+
: JavascriptResponse.Ok(code));
38+
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
39+
return response;
40+
}
41+
#endif
3242
}
3343
}

src/Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.UrlInspectionTool/Configuration/GoogleSearchConsoleOAuthSettings.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ public GoogleSearchConsoleOAuthSettings(NameValueCollection appSettings)
1616

1717
Scopes = appSettings[Constants.Configuration.UmbracoCmsIntegrationsSeoGoogleSearchConsoleScopesKey];
1818

19-
AuthorizationEndpoint = appSettings[Constants.Configuration.UmbracoCmsIntegrationsSeoGoogleSearchConsoleAuthorizationEndpointKey];
20-
2119
TokenEndpoint = appSettings[Constants.Configuration.UmbracoCmsIntegrationsSeoGoogleSearchConsoleTokenEndpointKey];
2220
}
2321

@@ -29,8 +27,6 @@ public GoogleSearchConsoleOAuthSettings(NameValueCollection appSettings)
2927

3028
public string Scopes { get; set; }
3129

32-
public string AuthorizationEndpoint { get; set; }
33-
3430
public string TokenEndpoint { get; set; }
3531
}
3632
}

0 commit comments

Comments
 (0)