Example #1
0
        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);
        }
Example #2
0
        public ActionResult Logout()
        {
            AuthenticationService.LogoutUser();

            var url = EnviromentVariablesFetcher.GetVaraiable(EnviromentVariables.IdentityUrl);

            return Redirect(url);
        }
Example #3
0
        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);
        }
Example #4
0
 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
     });
 }
Example #5
0
        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);
        }
Example #6
0
        public string GetUrl()
        {
            var redirectUrl = EnviromentVariablesFetcher.GetVaraiable(EnviromentVariables.IdentityRedirectUrl);

            if (!redirectUrl.EndsWith("/"))
            {
                redirectUrl += "/";
            }

            return(redirectUrl);
        }
Example #7
0
 public EnviromentConnectionStringVariable(string name, string enviromentVariableName)
 {
     Name  = name;
     Value = EnviromentVariablesFetcher.GetVaraiable(enviromentVariableName);
 }