public IActionResult Login(string returnUrl)
        {
            if (!_externalAuthenticationService.ExternalAuthenticationMethodIsAvailable(GoogleAuthenticationDefaults.ProviderSystemName))
            {
                throw new GrandException("Google authentication module cannot be loaded");
            }

            if (string.IsNullOrEmpty(_googleExternalAuthSettings.ClientKeyIdentifier) || string.IsNullOrEmpty(_googleExternalAuthSettings.ClientSecret))
            {
                throw new GrandException("Google authentication module not configured");
            }

            //configure login callback action
            var authenticationProperties = new AuthenticationProperties
            {
                RedirectUri = Url.Action("LoginCallback", "ExternalAuthGoogle", new { returnUrl = returnUrl })
            };

            return(Challenge(authenticationProperties, GoogleDefaults.AuthenticationScheme));
        }
        public IActionResult Login(string returnUrl)
        {
            if (!_externalAuthenticationService.ExternalAuthenticationMethodIsAvailable(LinkedInExternalAuthConstants.ProviderSystemName))
            {
                throw new NopException("LinkedIn authentication module cannot be loaded");
            }

            if (string.IsNullOrEmpty(_linkedInExternalAuthSettings.ClientKeyIdentifier) || string.IsNullOrEmpty(_linkedInExternalAuthSettings.ClientSecret))
            {
                throw new NopException("LinkedIn authentication module not configured");
            }

            //configure login callback action
            var authenticationProperties = new AuthenticationProperties
            {
                RedirectUri = Url.Action("LoginCallback", "PSLinkedInAuthentication", new { returnUrl = returnUrl })
            };

            return(Challenge(authenticationProperties, LinkedInExternalAuthConstants.LinkedInAuthenticationScheme));
        }
Beispiel #3
0
        public IActionResult Login(string returnUrl)
        {
            if (!_externalAuthenticationService.ExternalAuthenticationMethodIsAvailable(FacebookAuthenticationDefaults.ProviderSystemName))
            {
                throw new NopException("Facebook authentication module cannot be loaded");
            }

            if (string.IsNullOrEmpty(_facebookExternalAuthSettings.ClientKeyIdentifier) || string.IsNullOrEmpty(_facebookExternalAuthSettings.ClientSecret))
            {
                throw new NopException("Facebook authentication module not configured");
            }

            //configure login callback action
            var authenticationProperties = new AuthenticationProperties
            {
                RedirectUri = Url.Action("LoginCallback", "FacebookAuthentication", new { returnUrl = returnUrl })
            };

            authenticationProperties.SetString("ErrorCallback", Url.RouteUrl("Login", new { returnUrl }));

            return(Challenge(authenticationProperties, FacebookDefaults.AuthenticationScheme));
        }