Esempio n. 1
0
        public IActionResult GoogleLogin()
        {
            string redirectUrl = Url.Action("GoogleResponse", "Account");
            var    properties  = AppSignInManager.ConfigureExternalAuthenticationProperties("Google", redirectUrl);

            return(new ChallengeResult("Google", properties));
        }
Esempio n. 2
0
        public IActionResult ExternalLogin(string provider, string returnTo = null)
        {
            var redirectUrl = Url.RouteUrl("GetExternalLoginCallBack", new { returnTo }, Request.Scheme);

            var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);

            return(Challenge(properties, provider));
        }
Esempio n. 3
0
        public IActionResult OnPost(string provider, string returnUrl = null)
        {
            // Request a redirect to the external login provider.
            var redirectUrl = Url.Page("./ExternalLogin", pageHandler: "Callback", values: new { returnUrl });
            var properties  = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);

            return(new ChallengeResult(provider, properties));
        }
Esempio n. 4
0
        public async Task <IActionResult> OnPostLinkLoginAsync(string provider)
        {
            // Clear the existing external cookie to ensure a clean login process
            await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);

            // Request a redirect to the external login provider to link a login for the current user
            var redirectUrl = Url.Page("./ExternalLogins", pageHandler: "LinkLoginCallback");
            var properties  = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl, _userManager.GetUserId(User));

            return(new ChallengeResult(provider, properties));
        }