Пример #1
0
 public OrderController(CartService cartService, IClientService clientService, ICookieHandler cookieHandler, IHttpContextAccessor accessor)
 {
     _cartService   = cartService;
     _clientService = clientService;
     _cookieHandler = cookieHandler;
     _session       = accessor.HttpContext.Session;
 }
 public set_user_from_http_cookie_if_current_user_is_not_authenticated(IRepository repository, ICookieHandler cookieHandler)
 {
     _repository    = repository;
     _cookieHandler = cookieHandler;
     // TODO somehow get access to the HttpRequest to read the cookie
     //if (HttpContext.Current != null)
     //    _cookieHandler.ForHttpRequest(HttpContext.Current.Request);
 }
Пример #3
0
 public HomeController(IPermissionChecker permissionChecker, IMySession mySession, ICookieHandler cookieHandler, IAuthentication authentication)
     : base()
 {
     _permissionChecker = permissionChecker;
     _mySession         = mySession;
     _cookieHandler     = cookieHandler;
     _authentication    = authentication;
 }
Пример #4
0
        private async Task <LoginViewModel> BuildLoginViewModelAsync(
            LoginInputModel model, ICookieHandler cookieHandler)
        {
            var vm = await BuildLoginViewModelAsync(model.ReturnUrl, cookieHandler);

            vm.Username      = model.Username;
            vm.RememberLogin = model.RememberLogin;
            return(vm);
        }
Пример #5
0
 public ContactController(IContactFormSubmissionWriter contactFormSubmissionWriter, IContactFormSubmissionLoader contactFormSubmissionLoader, IContractLoader contractLoader, ICurriculumVitaeReader cvReader, ISmtpService smtpService, IContactFormFactory contactFormFactory, ICookieHandler cookieHandler)
 {
     _contactFormSubmissionWriter = contactFormSubmissionWriter;
     _contactFormSubmissionLoader = contactFormSubmissionLoader;
     _contractLoader     = contractLoader;
     _cvReader           = cvReader;
     _smtpService        = smtpService;
     _contactFormFactory = contactFormFactory;
     _cookieHandler      = cookieHandler;
 }
Пример #6
0
 public ContactController(IContactFormSubmissionWriter contactFormSubmissionWriter, IContactFormSubmissionLoader contactFormSubmissionLoader, IContractLoader contractLoader, ICurriculumVitaeReader cvReader, ISmtpService smtpService, IContactFormFactory contactFormFactory, ICookieHandler cookieHandler)
 {
     _contactFormSubmissionWriter = contactFormSubmissionWriter;
     _contactFormSubmissionLoader = contactFormSubmissionLoader;
     _contractLoader = contractLoader;
     _cvReader = cvReader;
     _smtpService = smtpService;
     _contactFormFactory = contactFormFactory;
     _cookieHandler = cookieHandler;
 }
 public LogoutController(ICookieHandler cookieHandler)
 {
     _cookieHandler = cookieHandler;
 }
Пример #8
0
 public LoginController(ICookieHandler cookieHandler, IClientService clientService)
 {
     _cookieHandler = cookieHandler;
     _clientService = clientService;
 }
Пример #9
0
 public ContactFormFactory(IContactFormSubmissionLoader loader, ICookieHandler cookieHandler)
 {
     _loader = loader;
     _cookieHandler = cookieHandler;
 }
Пример #10
0
 public ContactFormFactory(IContactFormSubmissionLoader loader, ICookieHandler cookieHandler)
 {
     _loader        = loader;
     _cookieHandler = cookieHandler;
 }
Пример #11
0
 public OrderService(ICookieHandler cookieHandler, CartService cartService)
 {
     this._cookieHandler = cookieHandler;
     this._cartService   = cartService;
 }
 public AccountController(IClientService clientService, ICookieHandler cookieHandler)
 {
     this._clientService = clientService;
     this._cookieHandler = cookieHandler;
 }
Пример #13
0
 public ClientService(ICookieHandler cookieHandler)
 {
     _cookieHandler = cookieHandler;
 }
Пример #14
0
        /*****************************************/
        /* helper APIs for the AccountController */
        /*****************************************/
        private async Task <LoginViewModel> BuildLoginViewModelAsync(
            string returnUrl, ICookieHandler cookieHandler)
        {
            var rememberLogin = cookieHandler != null
        ? cookieHandler.GetBoolValue(Cookies.cookieKeyRememberLogin)
        : false;

            var context = await _interaction.GetAuthorizationContextAsync(returnUrl);

            if (context?.IdP != null)
            {
                // this is meant to short circuit the UI and only trigger the one external IdP
                return(new LoginViewModel
                {
                    EnableLocalLogin = false,
                    ReturnUrl = returnUrl,
                    Username = context?.LoginHint,
                    ExternalProviders = new ExternalProvider[] { new ExternalProvider {
                                                                     AuthenticationScheme = context.IdP
                                                                 } }
                });
            }

            var schemes = await _schemeProvider.GetAllSchemesAsync();

            var providers = schemes
                            .Where(x => x.DisplayName != null ||
                                   (x.Name.Equals(AccountOptions.WindowsAuthenticationSchemeName, StringComparison.OrdinalIgnoreCase))
                                   )
                            .Select(x => new ExternalProvider
            {
                DisplayName          = x.DisplayName,
                AuthenticationScheme = x.Name
            }).ToList();

            var allowLocal = true;

            if (context?.ClientId != null)
            {
                var client = await _clientStore.FindEnabledClientByIdAsync(context.ClientId);

                if (client != null)
                {
                    allowLocal = client.EnableLocalLogin;

                    if (client.IdentityProviderRestrictions != null && client.IdentityProviderRestrictions.Any())
                    {
                        providers = providers.Where(provider => client.IdentityProviderRestrictions.Contains(provider.AuthenticationScheme)).ToList();
                    }
                }
            }

            return(new LoginViewModel
            {
                AllowRememberLogin = AccountOptions.AllowRememberLogin,
                RememberLogin = rememberLogin,
                EnableLocalLogin = allowLocal && AccountOptions.AllowLocalLogin,
                ReturnUrl = returnUrl,
                Username = context?.LoginHint,
                ExternalProviders = providers.ToArray()
            });
        }
Пример #15
0
 public Authentication(IMySession mySession, IClsUser clsUser, ICookieHandler cookieHandler)
 {
     _mySession     = mySession;
     _clsUserEntity = clsUser;
     _cookieHandler = cookieHandler;
 }