public async Task <IActionResult> InitiateSingleSignOn() { /* var userName = User.Identity.Name;*/ /* new SamlAttribute("UserName", User.FindFirst(ClaimTypes.Email)?.Value.ToString()),*/ var userName = "******"; var attributes = new List <SamlAttribute>() { new SamlAttribute("UserName", userName), /* new SamlAttribute("FirstName", User.FindFirst(ClaimTypes.GivenName)?.Value.ToString()),//FirstName * new SamlAttribute("LastName", User.FindFirst(ClaimTypes.Surname)?.Value.ToString()),//LastName * new SamlAttribute(ClaimTypes.NameIdentifier, User.FindFirst(ClaimTypes.NameIdentifier)?.Value.ToString()),*/ new SamlAttribute("PartnerName", "Liberty") }; //var partnerName = _configuration["PartnerName"]; var partnerName = _configuration["ThinkEduApi"]; var relayState = _configuration["RelayState"]; // Initiate single sign-on to the service provider (IdP-initiated SSO) // by sending a SAML response containing a SAML assertion to the SP. // The optional relay state normally specifies the target URL once SSO completes. await _samlIdentityProvider.InitiateSsoAsync(partnerName, userName, attributes, relayState); return(Ok("asdasd")); }
public async Task <IActionResult> InitiateSingleSignOn() { var userName = User.Identity.Name; var partnerName = _configuration["PartnerName"]; var relayState = _configuration["RelayState"]; 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), }; //sending SAML response containing a SAML assertion await _samlIdentityProvider.InitiateSsoAsync(partnerName, userName, attributes, relayState); return(new EmptyResult()); }
public async Task <ActionResult> SingleSignOn() { // Get the name of the logged in user. var userName = "******"; // For demonstration purposes, include some claims. var attributes = new List <SamlAttribute>() { new SamlAttribute(ClaimTypes.GivenName, "avb"), new SamlAttribute(ClaimTypes.Surname, "avb") }; // Initiate single sign-on to the service provider (IdP-initiated SSO) // by sending a SAML response containing a SAML assertion to the SP. // The optional relay state normally specifies the target URL once SSO completes. var partnerName = _configuration["PartnerName"]; var relayState = _configuration["RelayState"]; System.Diagnostics.Debug.WriteLine("test"); await _samlIdentityProvider.InitiateSsoAsync(partnerName, userName, attributes, relayState); return(new EmptyResult()); }