Example #1
0
 public AuthController(IHttpContextAccessor accessor, ITimeService time, MilvanethDbContext context, IAuthentication auth, IPowService pow, ISrp6Service srp, IApiKeySignService api)
 {
     _accessor  = accessor;
     _time      = time;
     _context   = context;
     _auth      = auth;
     _pow       = pow;
     _srp       = srp;
     _api       = api;
     _authToken = _context.KeyUsage.Single(x => x.Name == "Auth Token");
 }
Example #2
0
 public AccountController(IHttpContextAccessor accessor, ITimeService time, MilvanethDbContext context, IAuthentication auth, IPowService pow, ISrp6Service srp, IApiKeySignService api, ITokenSignService token, IVerifyMailService mail, IRepository repo)
 {
     _accessor      = accessor;
     _time          = time;
     _context       = context;
     _auth          = auth;
     _pow           = pow;
     _srp           = srp;
     _api           = api;
     _token         = token;
     _mail          = mail;
     _repo          = repo;
     _userPrivilege = _context.PrivilegeConfig.Single(x => x.Name == "User");
     _changeToken   = _context.KeyUsage.Single(x => x.Name == "Password Change Token");
 }
        public Srp6MultiStepService(ITimeService time, IPowService pow)
        {
            _time         = time;
            _pow          = pow;
            _cryptoRandom = new SecureRandom(new CryptoApiRandomGenerator());
            _sessions     = new ConcurrentDictionary <long, Srp6Context>();
            _hash         = new Sha256Digest();

            Task.Run(() =>
            {
                for (;;)
                {
                    Thread.Sleep(GlobalConfig.SRP6_SESSION_LIFE_TIME * 1000);
                    var now = _time.UtcNow;

                    var list = _sessions.Where(x => x.Value.Expire < now).Select(x => x.Key).ToImmutableList();
                    foreach (var key in list)
                    {
                        _sessions.TryRemove(key, out _);
                    }
                }
            });
        }
Example #4
0
 public DataController(IHttpContextAccessor accessor, ITimeService time, MilvanethDbContext context, IAuthentication auth, IPowService pow, ISrp6Service srp, IApiKeySignService api, ITokenSignService token, IVerifyMailService mail, IRepository repo)
 {
     _time    = time;
     _context = context;
     _auth    = auth;
     _token   = token;
     _repo    = repo;
 }