Skip to content

Commit 4f20ac1

Browse files
Merge pull request #6538 from bdukes/host-settings
Introduce IHostSettings to replace Host class
2 parents b0ed193 + e0f2d3a commit 4f20ac1

File tree

146 files changed

+4161
-2175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+4161
-2175
lines changed

DNN Platform/Admin Modules/Dnn.Modules.Console/ViewConsole.ascx.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,26 @@ public partial class ViewConsole : PortalModuleBase
3333
{
3434
private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ViewConsole));
3535
private readonly INavigationManager navigationManager;
36+
private readonly IJavaScriptLibraryHelper javaScript;
37+
3638
private string defaultSize = string.Empty;
3739
private string defaultView = string.Empty;
38-
private int groupTabID = -1;
40+
private int groupTabId = -1;
3941
private IList<TabInfo> tabs;
4042

4143
/// <summary>Initializes a new instance of the <see cref="ViewConsole"/> class.</summary>
4244
public ViewConsole()
45+
: this(null, null)
46+
{
47+
}
48+
49+
/// <summary>Initializes a new instance of the <see cref="ViewConsole"/> class.</summary>
50+
/// <param name="navigationManager">The navigation manager.</param>
51+
/// <param name="javaScript">The JavaScript library helper.</param>
52+
public ViewConsole(INavigationManager navigationManager, IJavaScriptLibraryHelper javaScript)
4353
{
44-
this.navigationManager = this.DependencyProvider.GetRequiredService<INavigationManager>();
54+
this.navigationManager = navigationManager ?? this.DependencyProvider.GetRequiredService<INavigationManager>();
55+
this.javaScript = javaScript ?? this.DependencyProvider.GetRequiredService<IJavaScriptLibraryHelper>();
4556
}
4657

4758
/// <summary>Gets a value indicating whether the module settings allow size change.</summary>
@@ -200,7 +211,7 @@ protected override void OnInit(EventArgs e)
200211

201212
try
202213
{
203-
JavaScript.RequestRegistration(CommonJs.jQuery);
214+
this.javaScript.RequestRegistration(CommonJs.jQuery);
204215

205216
ClientResourceManager.RegisterScript(this.Page, "~/desktopmodules/admin/console/scripts/jquery.console.js");
206217

@@ -313,9 +324,9 @@ protected override void OnLoad(EventArgs e)
313324
protected string GetHtml(TabInfo tab)
314325
{
315326
string returnValue = string.Empty;
316-
if (this.groupTabID > -1 && this.groupTabID != tab.ParentId)
327+
if (this.groupTabId > -1 && this.groupTabId != tab.ParentId)
317328
{
318-
this.groupTabID = -1;
329+
this.groupTabId = -1;
319330
if (!tab.DisableLink)
320331
{
321332
returnValue = "<br style=\"clear:both;\" /><br />";
@@ -326,7 +337,7 @@ protected string GetHtml(TabInfo tab)
326337
{
327338
const string headerHtml = "<br style=\"clear:both;\" /><br /><h1><span class=\"TitleHead\">{0}</span></h1><br style=\"clear:both\" />";
328339
returnValue += string.Format(headerHtml, tab.TabName);
329-
this.groupTabID = tab.TabID;
340+
this.groupTabId = tab.TabID;
330341
}
331342
else
332343
{
@@ -535,7 +546,7 @@ private void SaveUserSetting(string key, object val)
535546

536547
private void RepeaterItemDataBound(object sender, RepeaterItemEventArgs e)
537548
{
538-
var tab = e.Item.DataItem as TabInfo;
549+
var tab = (TabInfo)e.Item.DataItem;
539550
e.Item.Controls.Add(new Literal() { Text = this.GetHtml(tab) });
540551
if (this.tabs.Any(t => t.ParentId == tab.TabID))
541552
{

DNN Platform/Dnn.AuthServices.Jwt/Auth/JwtAuthMessageHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class JwtAuthMessageHandler : AuthMessageHandlerBase
2626
private readonly IJwtController jwtController = JwtController.Instance;
2727

2828
/// <summary>Initializes a new instance of the <see cref="JwtAuthMessageHandler"/> class.</summary>
29-
/// <param name="includeByDefault">A value indicating whether this handler should be inlcuded by default on all API endpoints.</param>
29+
/// <param name="includeByDefault">A value indicating whether this handler should be included by default on all API endpoints.</param>
3030
/// <param name="forceSsl">A value indicating whether this handler should enforce SSL usage.</param>
3131
public JwtAuthMessageHandler(bool includeByDefault, bool forceSsl)
3232
: base(includeByDefault, forceSsl)

DNN Platform/Dnn.AuthServices.Jwt/Data/DataService.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,44 @@ namespace Dnn.AuthServices.Jwt.Data
99
using System.Web.Caching;
1010

1111
using Dnn.AuthServices.Jwt.Components.Entity;
12+
13+
using DotNetNuke.Abstractions.Application;
14+
using DotNetNuke.Common;
15+
using DotNetNuke.Common.Extensions;
1216
using DotNetNuke.Common.Utilities;
1317
using DotNetNuke.ComponentModel;
1418
using DotNetNuke.Data;
19+
using DotNetNuke.Entities.Controllers;
20+
using DotNetNuke.Entities.Host;
21+
22+
using Microsoft.Extensions.DependencyInjection;
1523

1624
/// <summary>This class provides the Data Access Layer for the JWT Authentication library.</summary>
1725
public class DataService : ComponentBase<IDataService, DataService>, IDataService
1826
{
1927
private readonly DataProvider dataProvider = DataProvider.Instance();
28+
private readonly IHostSettings hostSettings;
29+
30+
/// <summary>Initializes a new instance of the <see cref="DataService"/> class.</summary>
31+
public DataService()
32+
: this(null)
33+
{
34+
}
35+
36+
/// <summary>Initializes a new instance of the <see cref="DataService"/> class.</summary>
37+
/// <param name="hostSettings">The host settings.</param>
38+
public DataService(IHostSettings hostSettings)
39+
{
40+
this.hostSettings = hostSettings ?? HttpContextSource.Current?.GetScope().ServiceProvider.GetRequiredService<IHostSettings>() ?? new HostSettings(new HostController());
41+
}
2042

2143
/// <inheritdoc/>
2244
public virtual PersistedToken GetTokenById(string tokenId)
2345
{
2446
try
2547
{
2648
return CBO.GetCachedObject<PersistedToken>(
49+
this.hostSettings,
2750
new CacheItemArgs(GetCacheKey(tokenId), 60, CacheItemPriority.Default),
2851
_ => CBO.FillObject<PersistedToken>(this.dataProvider.ExecuteReader("JsonWebTokens_GetById", tokenId)));
2952
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information
4+
5+
namespace DotNetNuke.Abstractions.Application;
6+
7+
/// <summary>Provides enumerated values that are used to set the <c>Cache-Control</c> HTTP header.</summary>
8+
/// <remarks>This is a copy of <c>System.Web.HttpCacheability</c>, which is defined in System.Web (and therefore not available in .NET Standard 2.0).</remarks>
9+
/// <seealso href="https://learn.microsoft.com/en-us/dotnet/api/system.web.httpcacheability"/>
10+
public enum CacheControlHeader
11+
{
12+
/// <summary>A header value that is unknown.</summary>
13+
Unknown = 0,
14+
15+
/// <summary>Sets the <c>Cache-Control: no-cache</c> header. Without a field name, the directive applies to the entire request and a shared (proxy server) cache must force a successful revalidation with the origin Web server before satisfying the request. With a field name, the directive applies only to the named field; the rest of the response may be supplied from a shared cache.</summary>
16+
NoCache = 1,
17+
18+
/// <summary>Default value. Sets <c>Cache-Control: private</c> to specify that the response is cacheable only on the client and not by shared (proxy server) caches.</summary>
19+
Private = 2,
20+
21+
/// <summary>Specifies that the response is cached only at the origin server. Similar to the <see cref="NoCache" /> option. Clients receive a <c>Cache-Control: no-cache</c> directive but the document is cached on the origin server. Equivalent to <see cref="ServerAndNoCache" />.</summary>
22+
Server = 3,
23+
24+
/// <summary>Applies the settings of both <see cref="Server" /> and <see cref="NoCache" /> to indicate that the content is cached at the server but all others are explicitly denied the ability to cache the response.</summary>
25+
ServerAndNoCache = 3,
26+
27+
/// <summary>Sets <c>Cache-Control: public</c> to specify that the response is cacheable by clients and shared (proxy) caches.</summary>
28+
Public = 4,
29+
30+
/// <summary>Indicates that the response is cached at the server and at the client but nowhere else. Proxy servers are not allowed to cache the response.</summary>
31+
ServerAndPrivate = 5,
32+
}

DNN Platform/DotNetNuke.Abstractions/Application/IApplicationInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public interface IApplicationInfo
1616
/// Gets the version of the currently installed DotNetNuke framework/application
1717
/// Can be prior to Version, if the application is pending to be upgraded.
1818
/// </summary>
19-
/// <value>The version as retreieved from the database version table.</value>
19+
/// <value>The version as retrieved from the database version table.</value>
2020
Version CurrentVersion { get; }
2121

2222
/// <summary>Gets the description of the application.</summary>
@@ -69,7 +69,7 @@ public interface IApplicationInfo
6969
string Url { get; }
7070

7171
/// <summary>Gets the version of the DotNetNuke framework/application.</summary>
72-
/// <value>The version as retreieved from the Executing assembly.</value>
72+
/// <value>The version as retrieved from the Executing assembly.</value>
7373
Version Version { get; }
7474

7575
/// <summary> Determine whether a product specific change is to be applied.</summary>

0 commit comments

Comments
 (0)