-
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathBankIdCommonConfiguration.cs
More file actions
54 lines (40 loc) · 2.32 KB
/
BankIdCommonConfiguration.cs
File metadata and controls
54 lines (40 loc) · 2.32 KB
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
50
51
52
53
54
using System.Reflection;
using ActiveLogin.Authentication.BankId.AspNetCore.Cookies;
using ActiveLogin.Authentication.BankId.AspNetCore.DataProtection;
using ActiveLogin.Authentication.BankId.AspNetCore.Launcher;
using ActiveLogin.Authentication.BankId.AspNetCore.StateHandling;
using ActiveLogin.Authentication.BankId.AspNetCore.SupportedDevice;
using ActiveLogin.Authentication.BankId.AspNetCore.UserContext;
using ActiveLogin.Authentication.BankId.AspNetCore.UserContext.Device;
using ActiveLogin.Authentication.BankId.Core;
using ActiveLogin.Authentication.BankId.Core.Launcher;
using ActiveLogin.Authentication.BankId.Core.SupportedDevice;
using ActiveLogin.Authentication.BankId.Core.UserContext;
using Microsoft.Extensions.DependencyInjection;
namespace ActiveLogin.Authentication.BankId.AspNetCore;
internal static class BankIdCommonConfiguration
{
private const string UnknownProductVersion = "Unknown";
public static void AddDefaultServices(IServiceCollection services)
{
services.AddTransient<IBankIdUiOrderRefProtector, BankIdUiOrderRefProtector>();
services.AddTransient<IBankIdQrStartStateProtector, BankIdQrStartStateProtector>();
services.AddTransient<IBankIdUiOptionsProtector, BankIdUiOptionsProtector>();
services.AddTransient<IBankIdInvalidStateHandler, BankIdCancelUrlInvalidStateHandler>();
services.AddTransient<IBankIdSupportedDeviceDetector, BankIdSupportedDeviceDetector>();
services.AddTransient<IBankIdEndUserIpResolver, BankIdRemoteIpAddressEndUserIpResolver>();
services.AddTransient<ICustomBrowserResolver, BankIdCustomBrowserResolver>();
services.AddTransient<IBankIdRedirectUrlResolver, BankIdRedirectUrlResolver>();
services.AddHttpContextAccessor();
services.AddTransient<IBankIdUiOptionsCookieManager, BankIdUiOptionsCookieManager>();
services.AddDefaultDeviceData();
}
public static (string name, string version) GetActiveLoginInfo()
{
var productName = BankIdConstants.ProductName;
var productAssembly = typeof(ServiceCollectionBankIdExtensions).Assembly;
var assemblyFileVersion = productAssembly.GetCustomAttribute<AssemblyFileVersionAttribute>();
var productVersion = assemblyFileVersion?.Version ?? UnknownProductVersion;
return (productName, productVersion);
}
}