public async Task <IActionResult> SingleSignOnService() { // receive the request from SP (SP-initialed SSO) await _samlIdentityProvider.ReceiveSsoAsync(); if (User.Identity.IsAuthenticated) { var userName = User.Identity.Name; var attributes = new List <SamlAttribute>() { new SamlAttribute(ClaimTypes.Email, User.FindFirst(ClaimTypes.Email)?.Value), new SamlAttribute(ClaimTypes.GivenName, User.FindFirst(ClaimTypes.GivenName)?.Value), new SamlAttribute(ClaimTypes.Surname, User.FindFirst(ClaimTypes.Surname)?.Value) }; // sent to SP await _samlIdentityProvider.SendSsoAsync(userName, attributes); return(new EmptyResult()); } else { return(RedirectToAction("SingleSignOnServiceCompletion")); } }
public async Task <ActionResult> SingleSignOnService() { // Receive the authn request from the service provider (SP-initiated SSO). await _samlIdentityProvider.ReceiveSsoAsync(); // If the user isn't logged in at the identity provider, // have the user login before completing SSO. return(RedirectToAction("SingleSignOnServiceCompletion")); }
/*public async Task<IActionResult> InitiateSingleLogout(string returnUrl = null) * { * // Request logout at the service provider(s). * await _samlIdentityProvider.InitiateSloAsync(relayState: returnUrl); * * return new EmptyResult(); * }*/ public async Task <IActionResult> SingleSignOnService() { // Receive the authn request from the service provider (SP-initiated SSO). await _samlIdentityProvider.ReceiveSsoAsync(); // If the user is logged in at the identity provider, complete SSO immediately. // Otherwise have the user login before completing SSO. if (User.Identity.IsAuthenticated) { await CompleteSsoAsync(); return(new EmptyResult()); } else { return(await SingleSignOnServiceCompletion()); } }
public async Task ReceiveSsoAsync() { logger.LogInformation("Receiving SSO"); var something = await samlIdentityProvider.ReceiveSsoAsync(); }