public LoginTimeoutService(IServiceProvider serviceProvider, IConfiguration configuration) : base(ThreadPriority.Lowest, 15000) { scope = serviceProvider.CreateScope(); this.devOpsContext = scope.ServiceProvider.GetService <HydraDevOpsContext>(); this.serviceLoginLastActivityTimeOut = TimeSpan.Parse(configuration["ServiceLoginLastActivityTimeOut"]); }
public static UserLogin GetUserLogin(this HydraDevOpsContext devOpsContext, HttpRequest request) { var authorization = (string)request.Headers["Authorization"]; if (authorization.StartsWith("Bearer ")) { var token = authorization.RemoveStart("Bearer "); var userLogin = devOpsContext.UserLogins.SingleOrDefault(l => l.Token == token); return(userLogin); } return(null); }