public void TestGetRequestInvalidEncoding() { AuthRequest auth_request = new AuthRequest(TEST_SERVICE_PROVIDER_URL, TEST_REPLY_URL); string request = auth_request.GetRequest((AuthRequest.AuthRequestFormat) 5); Assert.IsNull(request); }
public void TestGetRequestValid() { AuthRequest auth_request = new AuthRequest(TEST_SERVICE_PROVIDER_URL, TEST_REPLY_URL); string request = auth_request.GetRequest(AuthRequest.AuthRequestFormat.Base64); Assert.IsNotNull(request); }
protected void Page_Load(object sender, EventArgs e) { AccountSettings accountSettings = new AccountSettings(); OneLogin.Saml.AuthRequest req = new AuthRequest(new AppSettings(), accountSettings); Response.Redirect(accountSettings.idp_sso_target_url + "?SAMLRequest=" + Server.UrlEncode(req.GetRequest(AuthRequest.AuthRequestFormat.Base64))); }
private static string GetRequestXml() { var request = new AuthRequest(); var requestXml = request.GetRequest(AuthRequest.AuthRequestFormat.Xml); return(requestXml); }
protected void lnkInitiateSSO_Click(object sender, EventArgs e) { AccountSettings accountSettings = new AccountSettings(); AuthRequest req = new AuthRequest(new AppSettings(), accountSettings); Response.Redirect(accountSettings.idp_sso_target_url + "?SAMLRequest=" + Server.UrlEncode(req.GetRequest(AuthRequest.AuthRequestFormat.Base64))); }
protected void Page_Load(object sender, EventArgs e) { if (Request.Form["SAMLResponse"] != null) { AccountSettings accountSettings = new AccountSettings(); OneLogin.Saml.Response samlResponse = new Response(accountSettings); samlResponse.LoadXmlFromBase64(Request.Form["SAMLResponse"]); if (samlResponse.IsValid()) { Response.Write("OK!\n"); Response.Write("Name ID: " + samlResponse.GetNameID() + "\n"); Session["username"] = samlResponse.GetNameID(); Session["sessionId"] = samlResponse.GetSessionId(); Response.Write("Session ID: " + Session["sessionId"]); ssoUserId.Value = samlResponse.GetNameID(); } else { Response.Write("Failed"); } } else { if (!Page.IsPostBack) { AccountSettings accountSettings = new AccountSettings(); OneLogin.Saml.AuthRequest req = new AuthRequest(new AppSettings(), accountSettings); Response.Redirect(accountSettings.idp_sso_target_url + "?SAMLRequest=" + Server.UrlEncode(req.GetRequest(AuthRequest.AuthRequestFormat.Base64))); } } }
public IActionResult Get() { AuthRequest req = new AuthRequest(configuration["Saml:Issuer"], configuration["Saml:IdPUrl"], configuration["Saml:AssertionUrl"]); return(Redirect(configuration["Saml:IdPUrl"] + "?SAMLRequest=" + req.GetRequest() + "&ReplayState=" + req.GetRelayState())); }