Skip to content

Commit e9a367f

Browse files
committed
Core - Add RequestContextExtensions.RegisterOwinSchemeHandlerFactory
1 parent 58e4622 commit e9a367f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

CefSharp/RequestContextExtensions.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Threading.Tasks;
1111
using CefSharp.Internals;
1212
using CefSharp.Preferences;
13+
using CefSharp.SchemeHandler;
1314

1415
namespace CefSharp
1516
{
@@ -208,5 +209,19 @@ public static Task<bool> ClearHttpAuthCredentialsAsync(this IRequestContext requ
208209

209210
return handler.Task;
210211
}
212+
213+
/// <summary>
214+
/// Extension method to register a instance of the <see cref="OwinSchemeHandlerFactory"/> with the provided <paramref name="appFunc"/>
215+
/// for the <paramref name="domainName"/>
216+
/// </summary>
217+
/// <param name="requestContext">request context</param>
218+
/// <param name="schemeName">scheme name, e.g. http(s). If registering for a custom scheme then that scheme must be already registered.
219+
/// It's recommended that you use https or http with a domain name rather than using a custom scheme.</param>
220+
/// <param name="domainName">Optional domain name</param>
221+
/// <param name="appFunc">OWIN AppFunc as defined at owin.org</param>
222+
public static void RegisterOwinSchemeHandlerFactory(this IRequestContext requestContext, string schemeName, string domainName, Func<IDictionary<string, object>, Task> appFunc)
223+
{
224+
requestContext.RegisterSchemeHandlerFactory(schemeName, domainName, new OwinSchemeHandlerFactory(appFunc));
225+
}
211226
}
212227
}

0 commit comments

Comments
 (0)