public static AuthenticationBuilder AddBankId(this AuthenticationBuilder builder, Action <IBankIdBuilder> bankId) { builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton <IPostConfigureOptions <BankIdOptions>, BankIdPostConfigureOptions>()); var bankIdBuilder = new BankIdBuilder(builder); bankIdBuilder.AddDefaultServices(); bankIdBuilder.UseUserAgent(GetActiveLoginUserAgent()); bankId(bankIdBuilder); return(builder); }
/// <summary> /// Add BankID authentication provider from Active Login. /// </summary> /// <param name="builder"></param> /// <param name="bankId">BankID configuration.</param> /// <example> /// <code> /// .AddBankId(builder => /// { /// builder /// .UseProductionEnvironment() /// .UseClientCertificateFromAzureKeyVault(Configuration.GetSection("ActiveLogin:BankId:ClientCertificate")) /// .AddSameDevice() /// .AddOtherDevice() /// .UseQrCoderQrCodeGenerator(); /// }); /// </code> /// </example> /// <returns></returns> public static AuthenticationBuilder AddBankId(this AuthenticationBuilder builder, Action <IBankIdBuilder> bankId) { var(activeLoginName, activeLoginVersion) = GetActiveLoginInfo(); builder.Services.Configure <BankIdActiveLoginContext>(context => { context.ActiveLoginProductName = activeLoginName; context.ActiveLoginProductVersion = activeLoginVersion; }); builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton <IPostConfigureOptions <BankIdOptions>, BankIdPostConfigureOptions>()); var bankIdBuilder = new BankIdBuilder(builder); bankIdBuilder.AddDefaultServices(); bankIdBuilder.UseUserAgent(GetActiveLoginUserAgent(activeLoginName, activeLoginVersion)); bankId(bankIdBuilder); return(builder); }