private void Authenticate(ActionExecutingContext filterContext) { if (filterContext.IsChildAction) { return; } var authenticationService = DependencyResolver.Current.GetService <IAuthenticationService>(); if (authenticationService.IsAuthenticated) { return; } var userProvider = DependencyResolver.Current.GetService <IUserProvider>(); var user = userProvider.GetUser(); if (user.IsResolved()) { authenticationService.LoginUser(user); return; } var url = EnviromentVariablesFetcher.GetVaraiable(EnviromentVariables.IdentityUrl); filterContext.Result = new RedirectResult(url); }
public ActionResult Logout() { AuthenticationService.LogoutUser(); var url = EnviromentVariablesFetcher.GetVaraiable(EnviromentVariables.IdentityUrl); return Redirect(url); }
public void EnstablishSession(UserSessionModel user) { var userCookie = new HttpCookie(Constants.Cookies.User, user.Username) { Domain = EnviromentVariablesFetcher.GetVaraiable(EnviromentVariables.UserCookieDomain), }; _httpContext.Context.Response.Cookies.Add(userCookie); }
private static void RegisterConnectionFactory(this IContainer container) { container.RegisterInstance <IConnectionFactory>(new ConnectionFactory { HostName = EnviromentVariablesFetcher.GetVaraiable(EnviromentVariables.RabbitMQHost), Port = EnviromentVariablesFetcher.GetVaraiable <int>(EnviromentVariables.RabbitMQPort), UserName = ConnectionFactory.DefaultUser, Password = ConnectionFactory.DefaultPass }); }
public TChannel GetChannel <TChannel>(string enviromentVaribaleForChannel) { var url = EnviromentVariablesFetcher.GetVaraiable(enviromentVaribaleForChannel); var address = new EndpointAddress(url); var binding = new BasicHttpBinding(); var channel = new ChannelFactory <TChannel>(binding, address); var service = channel.CreateChannel(); return(service); }
public string GetUrl() { var redirectUrl = EnviromentVariablesFetcher.GetVaraiable(EnviromentVariables.IdentityRedirectUrl); if (!redirectUrl.EndsWith("/")) { redirectUrl += "/"; } return(redirectUrl); }
public EnviromentConnectionStringVariable(string name, string enviromentVariableName) { Name = name; Value = EnviromentVariablesFetcher.GetVaraiable(enviromentVariableName); }