-
Notifications
You must be signed in to change notification settings - Fork 1
/
Startup.cs
49 lines (45 loc) · 1.77 KB
/
Startup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using EasyOC.ReplaceAction;
using EasyOC.Users.Controllers;
using EasyOC.Users.Handlers;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Modules;
using OrchardCore.OpenId.Controllers;
using OrchardCore.Users.Controllers;
using OrchardCore.Users.Handlers;
namespace EasyOC.Users
{
[Feature("EasyOC.Users")]
[RequireFeatures("OrchardCore.Users", "EasyOC.ReplaceAction")]
public class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
var targetService = services.FirstOrDefault(x => x.ImplementationType == typeof(ScriptExternalLoginEventHandler));
if (targetService != null)
{
services.Remove(targetService);
}
services.AddScoped<IExternalLoginEventHandler, EocScriptExternalLoginEventHandler>();
services.ReplaceActionByActionNames<EocAccountController>(
typeof(AccountController).FullName,
nameof(EocAccountController.LinkLoginCallback),
nameof(EocAccountController.ExternalLogins),
nameof(EocAccountController.LinkExternalLogin),
nameof(EocAccountController.ExternalLoginCallback),
nameof(EocAccountController.RegisterExternalLogin)
);
}
}
[Feature("EasyOC.OpenId.ImplicitLogout")]
[RequireFeatures("OrchardCore.OpenId", "EasyOC.ReplaceAction")]
public class OpenIdStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.ReplaceActionByActionNames<EocOpenIdAccessController>(
typeof(AccessController).FullName,
nameof(EocOpenIdAccessController.Logout)
);
}
}
}