public void SSOAuthenticatorTestWhenidPhasQueryParameter() { string email = "*****@*****.**"; string identityProviderUri = "http://www.baidu.com/?key1=value1"; var auth = new SSOAuthenticator(clientId, clientSecret, scope, redirectUri, email, identityProviderUri, null); Assert.IsNotNull(auth); string checkStr1 = "http://www.baidu.com/?key1=value1&returnTo=https%3A%2F%2Fidbroker.webex.com%2Fidb%2Foauth2%2Fv1%2Fauthorize%3FcisKeepMeSignedInOption%3D1%26response_type%3Dcode%26"; string checkStr2 = Uri.EscapeDataString("client_id=" + Uri.EscapeDataString(clientId) + "&redirect_uri=" + Uri.EscapeDataString(redirectUri)); string checkStr3 = "email%3D111%40cc.cc"; string url = auth.AuthorizationUrl; Assert.IsTrue(url.StartsWith(checkStr1)); Assert.IsTrue(url.Contains(checkStr2)); Assert.IsTrue(url.Contains(checkStr3)); }
public void SSOAuthenticatorTest() { string email = "*****@*****.**"; string identityProviderUri = "www.baidu.com"; List <KeyValuePair <string, string> > additionalQueryItems = new List <KeyValuePair <string, string> >(); additionalQueryItems.Add(new KeyValuePair <string, string>("key1", "value1://value1")); additionalQueryItems.Add(new KeyValuePair <string, string>("key2", "value2")); var auth = new SSOAuthenticator(clientId, clientSecret, scope, redirectUri, email, identityProviderUri, additionalQueryItems); Assert.IsNotNull(auth); string checkStr1 = "http://www.baidu.com/?returnTo=https%3A%2F%2Fidbroker.webex.com%2Fidb%2Foauth2%2Fv1%2Fauthorize%3FcisKeepMeSignedInOption%3D1%26response_type%3Dcode%26"; string checkStr2 = Uri.EscapeDataString("client_id=" + Uri.EscapeDataString(clientId) + "&redirect_uri=" + Uri.EscapeDataString(redirectUri)); string checkStr3 = "email%3D111%40cc.cc&key1=value1%3A%2F%2Fvalue1&key2=value2"; string url = auth.AuthorizationUrl; Assert.IsTrue(url.StartsWith(checkStr1)); Assert.IsTrue(url.Contains(checkStr2)); Assert.IsTrue(url.Contains(checkStr3)); }