示例#1
0
    public MfaFido2SignInFidoController(
        Fido2Storage fido2Storage,
        UserManager <ApplicationUser> userManager,
        SignInManager <ApplicationUser> signInManager,
        IOptions <Fido2Configuration> optionsFido2Configuration,
        IStringLocalizerFactory factory)
    {
        _userManager = userManager;
        _optionsFido2Configuration = optionsFido2Configuration;
        _signInManager             = signInManager;
        _userManager  = userManager;
        _fido2Storage = fido2Storage;

        var type         = typeof(SharedResource);
        var assemblyName = new AssemblyName(type.GetTypeInfo().Assembly.FullName);

        _sharedLocalizer = factory.Create("SharedResource", assemblyName.Name);

        _lib = new Fido2(new Fido2Configuration()
        {
            ServerDomain            = _optionsFido2Configuration.Value.ServerDomain,
            ServerName              = _optionsFido2Configuration.Value.ServerName,
            Origin                  = _optionsFido2Configuration.Value.Origin,
            TimestampDriftTolerance = _optionsFido2Configuration.Value.TimestampDriftTolerance
        });
    }
示例#2
0
        public AccountController(
            UserManager <ApplicationUser> userManager,
            IPersistedGrantService persistedGrantService,
            SignInManager <ApplicationUser> signInManager,
            IEmailSender emailSender,
            ILoggerFactory loggerFactory,
            IIdentityServerInteractionService interaction,
            IClientStore clientStore,
            IStringLocalizerFactory factory,
            Fido2Storage fido2Storage,
            IAuthenticationSchemeProvider schemeProvider,
            IEventService events)

        {
            _fido2Storage          = fido2Storage;
            _userManager           = userManager;
            _persistedGrantService = persistedGrantService;
            _signInManager         = signInManager;
            _emailSender           = emailSender;
            _logger         = loggerFactory.CreateLogger <AccountController>();
            _interaction    = interaction;
            _clientStore    = clientStore;
            _schemeProvider = schemeProvider;
            _events         = events;

            var type         = typeof(SharedResource);
            var assemblyName = new AssemblyName(type.GetTypeInfo().Assembly.FullName);

            _sharedLocalizer = factory.Create("SharedResource", assemblyName.Name);
        }
示例#3
0
        public LoginFido2Controller(IConfiguration config,
                                    Fido2Storage fido2Storage,
                                    UserManager <IdentityUser> userManager,
                                    SignInManager <IdentityUser> signInManager,
                                    IDistributedCache distributedCache)
        {
            _signInManager    = signInManager;
            _userManager      = userManager;
            _fido2Storage     = fido2Storage;
            _distributedCache = distributedCache;
            var MDSAccessKey    = config["fido2:MDSAccessKey"];
            var MDSCacheDirPath = config["fido2:MDSCacheDirPath"] ?? Path.Combine(Path.GetTempPath(), "fido2mdscache");

            _mds = string.IsNullOrEmpty(MDSAccessKey) ? null : MDSMetadata.Instance(MDSAccessKey, MDSCacheDirPath);
            if (null != _mds)
            {
                if (false == _mds.IsInitialized())
                {
                    _mds.Initialize().Wait();
                }
            }
            _origin = config["fido2:origin"];
            _lib    = new Fido2(new Fido2Configuration()
            {
                ServerDomain = config["fido2:serverDomain"],
                ServerName   = "Fido2 test",
                Origin       = _origin,
                // Only create and use Metadataservice if we have an acesskey
                MetadataService         = _mds,
                TimestampDriftTolerance = config.GetValue <int>("fido2:TimestampDriftTolerance")
            });
        }
示例#4
0
 public Disable2faModel(
     UserManager <IdentityUser> userManager,
     ILogger <Disable2faModel> logger,
     Fido2Storage fido2Storage)
 {
     _userManager  = userManager;
     _fido2Storage = fido2Storage;
     _logger       = logger;
 }
示例#5
0
 public Disable2faModel(
     UserManager <ApplicationUser> userManager,
     ILogger <Disable2faModel> logger,
     Fido2Storage fido2Storage)
 {
     _userManager  = userManager;
     _logger       = logger;
     _fido2Storage = fido2Storage;
 }
示例#6
0
 public LoginModel(SignInManager <IdentityUser> signInManager,
                   ILogger <LoginModel> logger,
                   UserManager <IdentityUser> userManager,
                   IEmailSender emailSender,
                   Fido2Storage fido2Storage)
 {
     _fido2Storage  = fido2Storage;
     _userManager   = userManager;
     _signInManager = signInManager;
     _emailSender   = emailSender;
     _logger        = logger;
 }
示例#7
0
 public AccountController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     IIdentityServerInteractionService interaction,
     IClientStore clientStore,
     IAuthenticationSchemeProvider schemeProvider,
     IEventService events,
     Fido2Storage fido2Storage)
 {
     _userManager    = userManager;
     _signInManager  = signInManager;
     _interaction    = interaction;
     _clientStore    = clientStore;
     _schemeProvider = schemeProvider;
     _events         = events;
     _fido2Storage   = fido2Storage;
 }
        public ManageController(
            UserManager <ApplicationUser> userManager,
            SignInManager <ApplicationUser> signInManager,
            IEmailSender emailSender,
            ILogger <ManageController> logger,
            UrlEncoder urlEncoder,
            IStringLocalizerFactory factory,
            Fido2Storage fido2Storage)
        {
            _userManager   = userManager;
            _signInManager = signInManager;
            _emailSender   = emailSender;
            _logger        = logger;
            _urlEncoder    = urlEncoder;
            _fido2Storage  = fido2Storage;

            var type         = typeof(SharedResource);
            var assemblyName = new AssemblyName(type.GetTypeInfo().Assembly.FullName);

            _sharedLocalizer = factory.Create("SharedResource", assemblyName.Name);
        }
示例#9
0
        public RegisterFido2Controller(IConfiguration config, Fido2Storage fido2Storage, UserManager <ApplicationUser> userManager, IDistributedCache distributedCache)
        {
            _userManager      = userManager;
            _fido2Storage     = fido2Storage;
            _distributedCache = distributedCache;
            var MDSAccessKey    = config["fido2:MDSAccessKey"];
            var MDSCacheDirPath = config["fido2:MDSCacheDirPath"] ?? Path.Combine(Path.GetTempPath(), "fido2mdscache");

            _mds = string.IsNullOrEmpty(MDSAccessKey) ? null : MDSMetadata.Instance(MDSAccessKey, MDSCacheDirPath);
            if (null != _mds)
            {
                if (false == _mds.IsInitialized())
                {
                    _mds.Initialize().Wait();
                }
            }
            _origin = config["fido2:origin"];
            if (_origin == null)
            {
                _origin = "https://localhost:44388";
            }

            var domain = config["fido2:serverDomain"];

            if (domain == null)
            {
                domain = "localhost";
            }

            _lib = new Fido2(new Fido2Configuration()
            {
                ServerDomain = domain,
                ServerName   = "Fido2IdentityMfa",
                Origin       = _origin,
                // Only create and use Metadataservice if we have an acesskey
                MetadataService         = _mds,
                TimestampDriftTolerance = config.GetValue <int>("fido2:TimestampDriftTolerance")
            });
        }