コード例 #1
0
        public void OpenIdConnectProtocolValidationContext_GetSets()
        {
            OpenIdConnectProtocolValidationContext validationContext = new OpenIdConnectProtocolValidationContext();
            Type type = typeof(OpenIdConnectProtocolValidationContext);

            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 2)
            {
                Assert.Fail("Number of properties has changed from 2 to: " + properties.Length + ", adjust tests");
            }

            GetSetContext context =
                new GetSetContext
            {
                PropertyNamesAndSetGetValue = new List <KeyValuePair <string, List <object> > >
                {
                    new KeyValuePair <string, List <object> >("AuthorizationCode", new List <object> {
                        (string)null, "AuthorizationCode", "AuthorizationCode_AuthorizationCode"
                    }),
                    new KeyValuePair <string, List <object> >("Nonce", new List <object> {
                        (string)null, "Nonce", "Nonce_Nonce"
                    }),
                },
                Object = validationContext,
            };

            TestUtilities.GetSet(context);
            TestUtilities.AssertFailIfErrors(MethodInfo.GetCurrentMethod().Name, context.Errors);
        }
コード例 #2
0
        /// <summary>
        /// Checks initial value, sets and then checks value. Works with multiple properties.
        /// </summary>
        /// <param name="context"> <see cref="GetSetContext"/>, drives the test.</param>
        public static void GetSet(GetSetContext context)
        {
            Type type = context.Object.GetType();

            foreach (KeyValuePair <string, List <object> > propertyKV in context.PropertyNamesAndSetGetValue)
            {
                PropertyInfo propertyInfo = type.GetProperty(propertyKV.Key);
                try
                {
                    if (propertyInfo.GetMethod != null)
                    {
                        object initialValue = propertyInfo.GetValue(context.Object, null);
                        if ((initialValue == null && propertyKV.Value[0] != null))
                        {
                            context.Errors.Add(propertyKV.Key + ": initial value == null && expected != null, expect initial value: " + propertyKV.Value[0].ToString());
                        }
                        else if (initialValue != null && propertyKV.Value[0] == null)
                        {
                            context.Errors.Add(propertyKV.Key + ": initial value != null && expected == null, initial value: " + initialValue.ToString());
                        }
                        else if (initialValue != null && !initialValue.Equals(propertyKV.Value[0]))
                        {
                            context.Errors.Add(propertyKV.Key + ", initial value != expected. expected: " + propertyKV.Value[0].ToString() + ", was: " + initialValue.ToString());
                        }
                    }

                    if (propertyInfo.SetMethod != null)
                    {
                        for (int i = 1; i < propertyKV.Value.Count; i++)
                        {
                            propertyInfo.SetValue(context.Object, propertyKV.Value[i]);
                            object getVal = propertyInfo.GetValue(context.Object, null);
                            if ((getVal == null && propertyKV.Value[i] != null))
                            {
                                context.Errors.Add(propertyKV.Key + "( " + i.ToString() + "), Get returned null, set was: " + propertyKV.Value[i].ToString());
                            }
                            else if (getVal != null && propertyKV.Value[i] == null)
                            {
                                context.Errors.Add(propertyKV.Key + "( " + i.ToString() + "), Get not null, set was null, get was: " + getVal);
                            }
                            else if (getVal != null && !getVal.Equals(propertyKV.Value[i]))
                            {
                                context.Errors.Add(propertyKV.Key + "( " + i.ToString() + ") Set did not equal get: " + propertyKV.Value[i].ToString() + ", " + getVal + ".");
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    context.Errors.Add(ex.ToString());
                }
            }
        }
        public void OpenIdConnectProtocolValidationContext_GetSets()
        {
            OpenIdConnectProtocolValidationContext validationContext = new OpenIdConnectProtocolValidationContext();
            Type type = typeof(OpenIdConnectProtocolValidationContext);
            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 2)
                Assert.Fail("Number of properties has changed from 2 to: " + properties.Length + ", adjust tests");

            GetSetContext context =
                new GetSetContext
                {
                    PropertyNamesAndSetGetValue = new List<KeyValuePair<string, List<object>>> 
                    { 
                        new KeyValuePair<string, List<object>>("AuthorizationCode", new List<object>{(string)null, "AuthorizationCode", "AuthorizationCode_AuthorizationCode"}),
                        new KeyValuePair<string, List<object>>("Nonce", new List<object>{(string)null, "Nonce", "Nonce_Nonce"}),                            
                    },
                    Object = validationContext,
                };
            TestUtilities.GetSet(context);
            TestUtilities.AssertFailIfErrors(MethodInfo.GetCurrentMethod().Name, context.Errors);
        }
        public void OpenIdConnectMessage_GetSets()
        {
            OpenIdConnectMessage message = new OpenIdConnectMessage();
            Type type = typeof(OpenIdConnectMessage);
            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 47)
                Assert.Fail("Number of public fields has changed from 47 to: " + properties.Length + ", adjust tests");

            GetSetContext context =
                new GetSetContext
                {
                    PropertyNamesAndSetGetValue = new List<KeyValuePair<string, List<object>>>
                    {
                        new KeyValuePair<string, List<object>>("IssuerAddress", new List<object>{string.Empty, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("AuthorizationEndpoint", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("AccessToken", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("AcrValues", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("ClaimsLocales", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("ClientAssertion", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("ClientAssertionType", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("ClientId", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("ClientSecret", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Code", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Display", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("DomainHint", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Error",  new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("ErrorDescription",  new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("ErrorUri",  new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("ExpiresIn",  new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("GrantType", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("IdToken", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("IdTokenHint", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("IdentityProvider", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("MaxAge", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Password", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("PostLogoutRedirectUri", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Prompt", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("RedirectUri", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("RequestUri", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("ResponseMode", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("ResponseType", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Resource", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Scope", new List<object>{null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("SessionState", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("State", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("TargetLinkUri", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Token", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("TokenEndpoint", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("TokenType", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("UiLocales", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("UserId", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Username", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                    },

                    Object = message,
                };

            TestUtilities.GetSet(context);

            if (context.Errors.Count != 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(Environment.NewLine);
                foreach (string str in context.Errors)
                    sb.AppendLine(str);

                Assert.Fail(sb.ToString());
            }
        }
        /// <summary>
        /// Checks initial value, sets and then checks value. Works with multiple properties.
        /// </summary>
        /// <param name="context"> <see cref="GetSetContext"/>, drives the test.</param>
        public static void GetSet(GetSetContext context)
        {
            Type type = context.Object.GetType();

            foreach (KeyValuePair<string, List<object>> propertyKV in context.PropertyNamesAndSetGetValue)
            {
                PropertyInfo propertyInfo = type.GetProperty(propertyKV.Key);
                try
                {
                    if (propertyInfo.GetMethod != null)
                    {
                        object initialValue = propertyInfo.GetValue(context.Object, null);
                        if ((initialValue == null && propertyKV.Value[0] != null))
                        {
                            context.Errors.Add(propertyKV.Key + ": initial value == null && expected != null, expect initial value: " + propertyKV.Value[0].ToString());
                        }
                        else if (initialValue != null && propertyKV.Value[0] == null)
                        {
                            context.Errors.Add(propertyKV.Key + ": initial value != null && expected == null, initial value: " + initialValue.ToString());
                        }
                        else if (initialValue != null && !initialValue.Equals(propertyKV.Value[0]))
                        {
                            context.Errors.Add(propertyKV.Key + ", initial value != expected. expected: " + propertyKV.Value[0].ToString() + ", was: " + initialValue.ToString());
                        }
                    }

                    if (propertyInfo.SetMethod != null)
                    {
                        for (int i = 1; i < propertyKV.Value.Count; i++)
                        {
                            propertyInfo.SetValue(context.Object, propertyKV.Value[i]);
                            object getVal = propertyInfo.GetValue(context.Object, null);
                            if ((getVal == null && propertyKV.Value[i] != null))
                            {
                                context.Errors.Add(propertyKV.Key + "( " + i.ToString() + "), Get returned null, set was: " + propertyKV.Value[i].ToString());
                            }
                            else if (getVal != null && propertyKV.Value[i] == null)
                            {
                                context.Errors.Add(propertyKV.Key + "( " + i.ToString() + "), Get not null, set was null, get was: " + getVal);
                            }
                            else if (getVal != null && !getVal.Equals(propertyKV.Value[i]))
                            {
                                context.Errors.Add(propertyKV.Key + "( " + i.ToString() + ") Set did not equal get: " + propertyKV.Value[i].ToString() + ", " + getVal + ".");
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    context.Errors.Add(ex.ToString());
                }
            }
        }
        public void JwtPayload_GetSets()
        {
            // Aud, Claims, ValidFrom, ValidTo handled in Defaults.

            JwtPayload jwtPayload = new JwtPayload();
            Type type = typeof(JwtPayload);
            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 20)
                Assert.Fail("Number of properties has changed from 20 to: " + properties.Length + ", adjust tests");

            GetSetContext context =
                new GetSetContext
                {
                    PropertyNamesAndSetGetValue = new List<KeyValuePair<string, List<object>>>
                    {
                        new KeyValuePair<string, List<object>>("Actort", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Acr", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Amr", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("AuthTime", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Azp", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("CHash", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Exp", new List<object>{(string)null, 1, 0 }),
                        new KeyValuePair<string, List<object>>("Jti", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Iat", new List<object>{(string)null, 10, 0}),
                        new KeyValuePair<string, List<object>>("Iss", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Nbf", new List<object>{(string)null, 1, 0 }),
                        new KeyValuePair<string, List<object>>("Nonce", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("Sub", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                    },
                    Object = jwtPayload,
                };
            TestUtilities.GetSet(context);

            if (context.Errors.Count != 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(Environment.NewLine);
                foreach (string str in context.Errors)
                    sb.AppendLine(str);

                Assert.Fail(sb.ToString());
            }
        }
        public void OpenIdConnectProtocolValidationContext_GetSets()
        {
            OpenIdConnectProtocolValidationContext validationContext = new OpenIdConnectProtocolValidationContext();
            Type type = typeof(OpenIdConnectProtocolValidationContext);
            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 3)
                Assert.Fail("Number of properties has changed from 3 to: " + properties.Length + ", adjust tests");

            GetSetContext context =
                new GetSetContext
                {
                    PropertyNamesAndSetGetValue = new List<KeyValuePair<string, List<object>>>
                    {
                        new KeyValuePair<string, List<object>>("AuthorizationCode", new List<object>{(string)null, "AuthorizationCode", "AuthorizationCode_AuthorizationCode"}),
                        new KeyValuePair<string, List<object>>("Nonce", new List<object>{(string)null, "Nonce", "Nonce_Nonce"}),
                    },
                    Object = validationContext,
                };
            TestUtilities.GetSet(context);

            if (context.Errors.Count != 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(Environment.NewLine);
                foreach(string str in context.Errors)
                    sb.AppendLine(str);

                Assert.Fail(sb.ToString());
            }

            Assert.IsNotNull(validationContext.OpenIdConnectProtocolValidationParameters);
            TestUtilities.SetGet(validationContext, "OpenIdConnectProtocolValidationParameters", (OpenIdConnectProtocolValidationParameters)null, ExpectedException.ArgumentNullException());
            TestUtilities.SetGet(validationContext, "OpenIdConnectProtocolValidationParameters", new OpenIdConnectProtocolValidationParameters(), ExpectedException.NoExceptionExpected);
        }
        public void OpenIdConnectMessage_GetSets()
        {
            OpenIdConnectMessage message = new OpenIdConnectMessage();
            Type type = typeof(OpenIdConnectMessage);

            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 47)
            {
                Assert.Fail("Number of public fields has changed from 47 to: " + properties.Length + ", adjust tests");
            }

            GetSetContext context =
                new GetSetContext
            {
                PropertyNamesAndSetGetValue = new List <KeyValuePair <string, List <object> > >
                {
                    new KeyValuePair <string, List <object> >("IssuerAddress", new List <object> {
                        string.Empty, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("AuthorizationEndpoint", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("AccessToken", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("AcrValues", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("ClaimsLocales", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("ClientAssertion", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("ClientAssertionType", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("ClientId", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("ClientSecret", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("Code", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("Display", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("DomainHint", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("Error", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("ErrorDescription", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("ErrorUri", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("ExpiresIn", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("GrantType", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("IdToken", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("IdTokenHint", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("IdentityProvider", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("MaxAge", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("Password", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("PostLogoutRedirectUri", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("Prompt", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("RedirectUri", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("RequestUri", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("ResponseMode", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("ResponseType", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("Resource", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("Scope", new List <object> {
                        null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("SessionState", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("State", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("TargetLinkUri", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("Token", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("TokenEndpoint", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("TokenType", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("UiLocales", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("UserId", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                    new KeyValuePair <string, List <object> >("Username", new List <object> {
                        (string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                    }),
                },

                Object = message,
            };

            TestUtilities.GetSet(context);

            if (context.Errors.Count != 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(Environment.NewLine);
                foreach (string str in context.Errors)
                {
                    sb.AppendLine(str);
                }

                Assert.Fail(sb.ToString());
            }
        }
コード例 #9
0
        public void OpenIdConnectProtocolValidator_GetSets()
        {
            OpenIdConnectProtocolValidator validationParameters = new OpenIdConnectProtocolValidator();
            Type type = typeof(OpenIdConnectProtocolValidator);

            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 9)
            {
                Assert.Fail("Number of properties has changed from 9 to: " + properties.Length + ", adjust tests");
            }

            GetSetContext context =
                new GetSetContext
            {
                PropertyNamesAndSetGetValue = new List <KeyValuePair <string, List <object> > >
                {
                    new KeyValuePair <string, List <object> >("NonceLifetime", new List <object> {
                        TimeSpan.FromMinutes(60), TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(100)
                    }),
                    new KeyValuePair <string, List <object> >("RequireAcr", new List <object> {
                        false, true, false
                    }),
                    new KeyValuePair <string, List <object> >("RequireAmr", new List <object> {
                        false, true, false
                    }),
                    new KeyValuePair <string, List <object> >("RequireAuthTime", new List <object> {
                        false, true, false
                    }),
                    new KeyValuePair <string, List <object> >("RequireAzp", new List <object> {
                        false, true, false
                    }),
                    new KeyValuePair <string, List <object> >("RequireNonce", new List <object> {
                        true, false, true
                    }),
                    new KeyValuePair <string, List <object> >("RequireSub", new List <object> {
                        false, true, false
                    }),
                    new KeyValuePair <string, List <object> >("RequireTimeStampInNonce", new List <object> {
                        true, false, true
                    }),
                },
                Object = validationParameters,
            };

            TestUtilities.GetSet(context);
            TestUtilities.AssertFailIfErrors(MethodInfo.GetCurrentMethod().Name, context.Errors);

            ExpectedException ee = ExpectedException.ArgumentNullException();

            Assert.IsNotNull(validationParameters.HashAlgorithmMap);
            Assert.AreEqual(validationParameters.HashAlgorithmMap.Count, 9);

            ee = ExpectedException.ArgumentOutOfRangeException();
            try
            {
                validationParameters.NonceLifetime = TimeSpan.Zero;
                ee.ProcessNoException();
            }
            catch (Exception ex)
            {
                ee.ProcessException(ex);
            }
        }
        public void OpenIdConnectProtocolValidationParameters_GetSets()
        {
            OpenIdConnectProtocolValidationParameters validationParameters = new OpenIdConnectProtocolValidationParameters();
            Type type = typeof(OpenIdConnectProtocolValidationParameters);
            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 8)
                Assert.Fail("Number of properties has changed from 8 to: " + properties.Length + ", adjust tests");

            GetSetContext context =
                new GetSetContext
                {
                    PropertyNamesAndSetGetValue = new List<KeyValuePair<string, List<object>>>
                    {
                        new KeyValuePair<string, List<object>>("RequireAcr", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("RequireAmr", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("RequireAuthTime", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("RequireAzp", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("RequireNonce", new List<object>{true, false, true}),
                        new KeyValuePair<string, List<object>>("RequireSub", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("ResponseType", new List<object>{OpenIdConnectMessage.DefaultResponseType, OpenIdConnectResponseTypes.IdToken, OpenIdConnectResponseTypes.CodeIdToken}),
                    },
                    Object = validationParameters,
                };

            TestUtilities.GetSet(context);
            if (context.Errors.Count != 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(Environment.NewLine);
                foreach(string str in context.Errors)
                    sb.AppendLine(str);

                Assert.Fail(sb.ToString());
            }

            ExpectedException ee = ExpectedException.ArgumentNullException();
            try
            {
                validationParameters.ResponseType = null;
                ee.ProcessNoException();
            }
            catch(Exception ex)
            {
                ee.ProcessException(ex);
            }

            Assert.IsNotNull(validationParameters.AlgorithmMap);
            Assert.AreEqual(validationParameters.AlgorithmMap.Count, 9);

            try
            {
                validationParameters.AlgorithmMap = null;
                ee.ProcessNoException();
            }
            catch (Exception ex)
            {
                ee.ProcessException(ex);
            }

            validationParameters.AlgorithmMap = JwtSecurityTokenHandler.InboundAlgorithmMap;
            Assert.IsTrue(IdentityComparer.AreEqual(JwtSecurityTokenHandler.InboundAlgorithmMap, validationParameters.AlgorithmMap));
        }
コード例 #11
0
        public void ConfigurationManager_GetSets()
        {
            ConfigurationManager <OpenIdConnectConfiguration> configManager = new ConfigurationManager <OpenIdConnectConfiguration>("OpenIdConnectMetadata.json");
            Type type = typeof(ConfigurationManager <OpenIdConnectConfiguration>);

            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 2)
            {
                Assert.Fail("Number of properties has changed from 2 to: " + properties.Length + ", adjust tests");
            }

            TimeSpan defaultAutomaticRefreshInterval = ConfigurationManager <OpenIdConnectConfiguration> .DefaultAutomaticRefreshInterval;
            TimeSpan defaultRefreshInterval          = ConfigurationManager <OpenIdConnectConfiguration> .DefaultRefreshInterval;

            GetSetContext context =
                new GetSetContext
            {
                PropertyNamesAndSetGetValue = new List <KeyValuePair <string, List <object> > >
                {
                    new KeyValuePair <string, List <object> >("AutomaticRefreshInterval", new List <object> {
                        defaultAutomaticRefreshInterval, TimeSpan.FromHours(1), TimeSpan.FromHours(10)
                    }),
                    new KeyValuePair <string, List <object> >("RefreshInterval", new List <object> {
                        defaultRefreshInterval, TimeSpan.FromHours(1), TimeSpan.FromHours(10)
                    }),
                },
                Object = configManager,
            };

            TestUtilities.GetSet(context);
            TestUtilities.AssertFailIfErrors(MethodInfo.GetCurrentMethod().Name, context.Errors);

            TestUtilities.SetGet(configManager, "AutomaticRefreshInterval", TimeSpan.FromMilliseconds(1), ExpectedException.ArgumentOutOfRangeException(substringExpected: "IDX10107:"));
            TestUtilities.SetGet(configManager, "RefreshInterval", TimeSpan.FromMilliseconds(1), ExpectedException.ArgumentOutOfRangeException(substringExpected: "IDX10106:"));
            TestUtilities.SetGet(configManager, "RefreshInterval", Timeout.InfiniteTimeSpan, ExpectedException.ArgumentOutOfRangeException(substringExpected: "IDX10106:"));

            // AutomaticRefreshInterval interval should return same config.
            OpenIdConnectConfiguration configuration = configManager.GetConfigurationAsync().Result;

            TestUtilities.SetField(configManager, "_metadataAddress", "OpenIdConnectMetadata2.json");
            OpenIdConnectConfiguration configuration2 = configManager.GetConfigurationAsync().Result;

            Assert.IsTrue(IdentityComparer.AreEqual <OpenIdConnectConfiguration>(configuration, configuration2));
            Assert.IsTrue(object.ReferenceEquals(configuration, configuration2));

            // AutomaticRefreshInterval should pick up new bits.
            configManager = new ConfigurationManager <OpenIdConnectConfiguration>("OpenIdConnectMetadata.json");
            TestUtilities.SetField(configManager, "_automaticRefreshInterval", TimeSpan.FromMilliseconds(1));
            configuration = configManager.GetConfigurationAsync().Result;
            Thread.Sleep(1);
            TestUtilities.SetField(configManager, "_metadataAddress", "OpenIdConnectMetadata2.json");
            configuration2 = configManager.GetConfigurationAsync().Result;
            Assert.IsFalse(IdentityComparer.AreEqual <OpenIdConnectConfiguration>(configuration, configuration2));
            Assert.IsFalse(object.ReferenceEquals(configuration, configuration2));

            // RefreshInterval is set to MaxValue
            configManager = new ConfigurationManager <OpenIdConnectConfiguration>("OpenIdConnectMetadata.json");
            configuration = configManager.GetConfigurationAsync().Result;
            configManager.RefreshInterval = TimeSpan.MaxValue;
            TestUtilities.SetField(configManager, "_metadataAddress", "OpenIdConnectMetadata2.json");
            configuration2 = configManager.GetConfigurationAsync().Result;
            Assert.IsTrue(IdentityComparer.AreEqual <OpenIdConnectConfiguration>(configuration, configuration2));
            Assert.IsTrue(object.ReferenceEquals(configuration, configuration2));

            // Refresh should have no effect
            configManager = new ConfigurationManager <OpenIdConnectConfiguration>("OpenIdConnectMetadata.json");
            configuration = configManager.GetConfigurationAsync().Result;
            configManager.RefreshInterval = TimeSpan.FromHours(10);
            configManager.RequestRefresh();
            configuration2 = configManager.GetConfigurationAsync().Result;
            Assert.IsTrue(IdentityComparer.AreEqual <OpenIdConnectConfiguration>(configuration, configuration2));
            Assert.IsTrue(object.ReferenceEquals(configuration, configuration2));

            // Refresh should force pickup of new config
            configManager = new ConfigurationManager <OpenIdConnectConfiguration>("OpenIdConnectMetadata.json");
            configuration = configManager.GetConfigurationAsync().Result;
            TestUtilities.SetField(configManager, "_refreshInterval", TimeSpan.FromMilliseconds(1));
            Thread.Sleep(1);
            configManager.RequestRefresh();
            TestUtilities.SetField(configManager, "_metadataAddress", "OpenIdConnectMetadata2.json");
            configuration2 = configManager.GetConfigurationAsync().Result;
            Assert.IsFalse(object.ReferenceEquals(configuration, configuration2));
            Assert.IsFalse(IdentityComparer.AreEqual <OpenIdConnectConfiguration>(configuration, configuration2));

            // Refresh set to MaxValue
            configManager.RefreshInterval = TimeSpan.MaxValue;
            configuration = configManager.GetConfigurationAsync().Result;
            Assert.IsTrue(object.ReferenceEquals(configuration, configuration2));
            Assert.IsTrue(IdentityComparer.AreEqual <OpenIdConnectConfiguration>(configuration, configuration2));
        }
        public void TokenValidationParameters_GetSets()
        {
            TokenValidationParameters validationParameters = new TokenValidationParameters();
            Type type = typeof(TokenValidationParameters);
            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 30)
                Assert.Fail("Number of public fields has changed from 30 to: " + properties.Length + ", adjust tests");

            GetSetContext context =
                new GetSetContext
                {
                    PropertyNamesAndSetGetValue = new List<KeyValuePair<string, List<object>>>
                    {
                        new KeyValuePair<string, List<object>>("AuthenticationType", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("CertificateValidator", new List<object>{(string)null, X509CertificateValidator.None, X509CertificateValidatorEx.None}),
                        new KeyValuePair<string, List<object>>("ClockSkew", new List<object>{TokenValidationParameters.DefaultClockSkew, TimeSpan.FromHours(2), TimeSpan.FromMinutes(1)}),
                        new KeyValuePair<string, List<object>>("IssuerSigningKey", new List<object>{(SecurityKey)null, KeyingMaterial.DefaultAsymmetricKey_Public_2048, KeyingMaterial.DefaultSymmetricSecurityKey_256}),
                        new KeyValuePair<string, List<object>>("IssuerSigningKeys", new List<object>{(IEnumerable<SecurityKey>)null, new List<SecurityKey>{KeyingMaterial.DefaultAsymmetricKey_Public_2048, KeyingMaterial.DefaultSymmetricSecurityKey_256}, new List<SecurityKey>()}),
                        new KeyValuePair<string, List<object>>("IssuerSigningToken", new List<object>{(SecurityToken)null, KeyingMaterial.DefaultSymmetricSecurityToken_256, KeyingMaterial.DefaultAsymmetricX509Token_2048}),
                        new KeyValuePair<string, List<object>>("IssuerSigningTokens", new List<object>{(IEnumerable<SecurityToken>)null, new List<SecurityToken>{KeyingMaterial.DefaultAsymmetricX509Token_2048, KeyingMaterial.DefaultSymmetricSecurityToken_256}, new List<SecurityToken>()}),
                        new KeyValuePair<string, List<object>>("NameClaimType", new List<object>{ClaimsIdentity.DefaultNameClaimType, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("RoleClaimType", new List<object>{ClaimsIdentity.DefaultRoleClaimType, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                        new KeyValuePair<string, List<object>>("RequireExpirationTime", new List<object>{true, false, true}),
                        new KeyValuePair<string, List<object>>("RequireSignedTokens", new List<object>{true, false, true}),
                        new KeyValuePair<string, List<object>>("SaveSigninToken", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("ValidateActor", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("ValidateAudience", new List<object>{true, false, true}),
                        new KeyValuePair<string, List<object>>("ValidateIssuer", new List<object>{true, false, true}),
                        new KeyValuePair<string, List<object>>("ValidateLifetime", new List<object>{true, false, true}),
                        new KeyValuePair<string, List<object>>("ValidIssuer", new List<object>{(string)null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()}),
                    },
                    Object = validationParameters,
                };
            TestUtilities.GetSet(context);

            if (context.Errors.Count != 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(Environment.NewLine);
                foreach (string str in context.Errors)
                    sb.AppendLine(str);

                Assert.Fail(sb.ToString());
            }

            Assert.IsNull(validationParameters.AudienceValidator);
            Assert.IsNotNull(validationParameters.ClientDecryptionTokens);
            Assert.AreEqual(validationParameters.ClientDecryptionTokens.Count, 0);
            Assert.IsNull(validationParameters.LifetimeValidator);
            Assert.IsNull(validationParameters.IssuerSigningKeyResolver);
            Assert.IsNull(validationParameters.IssuerValidator);
            Assert.IsNull(validationParameters.ValidAudiences);
            Assert.IsNull(validationParameters.ValidIssuers);
        }
        public void OpenIdConnectProtocolValidator_GetSets()
        {
            OpenIdConnectProtocolValidator validationParameters = new OpenIdConnectProtocolValidator();
            Type type = typeof(OpenIdConnectProtocolValidator);
            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 9)
                Assert.Fail("Number of properties has changed from 9 to: " + properties.Length + ", adjust tests");

            GetSetContext context =
                new GetSetContext
                {
                    PropertyNamesAndSetGetValue = new List<KeyValuePair<string, List<object>>>
                    {
                        new KeyValuePair<string, List<object>>("NonceLifetime", new List<object>{TimeSpan.FromMinutes(60), TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(100)}),
                        new KeyValuePair<string, List<object>>("RequireAcr", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("RequireAmr", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("RequireAuthTime", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("RequireAzp", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("RequireNonce", new List<object>{true, false, true}),
                        new KeyValuePair<string, List<object>>("RequireSub", new List<object>{false, true, false}),
                        new KeyValuePair<string, List<object>>("RequireTimeStampInNonce", new List<object>{true, false, true}),
                    },
                    Object = validationParameters,
                };

            TestUtilities.GetSet(context);
            TestUtilities.AssertFailIfErrors(MethodInfo.GetCurrentMethod().Name, context.Errors);

            ExpectedException ee = ExpectedException.ArgumentNullException();
            Assert.IsNotNull(validationParameters.HashAlgorithmMap);
            Assert.AreEqual(validationParameters.HashAlgorithmMap.Count, 9);

            ee = ExpectedException.ArgumentOutOfRangeException();
            try
            {
                validationParameters.NonceLifetime = TimeSpan.Zero;
                ee.ProcessNoException();
            }
            catch (Exception ex)
            {
                ee.ProcessException(ex);
            }
        }
        public void ConfigurationManager_GetSets()
        {
            ConfigurationManager<OpenIdConnectConfiguration> configManager = new ConfigurationManager<OpenIdConnectConfiguration>("OpenIdConnectMetadata.json");
            Type type = typeof(ConfigurationManager<OpenIdConnectConfiguration>);
            PropertyInfo[] properties = type.GetProperties();
            if (properties.Length != 2)
                Assert.Fail("Number of properties has changed from 2 to: " + properties.Length + ", adjust tests");

            TimeSpan defaultAutomaticRefreshInterval = ConfigurationManager<OpenIdConnectConfiguration>.DefaultAutomaticRefreshInterval;
            TimeSpan defaultRefreshInterval = ConfigurationManager<OpenIdConnectConfiguration>.DefaultRefreshInterval;

            GetSetContext context =
                new GetSetContext
                {
                    PropertyNamesAndSetGetValue = new List<KeyValuePair<string, List<object>>> 
                    { 
                        new KeyValuePair<string, List<object>>("AutomaticRefreshInterval", new List<object>{defaultAutomaticRefreshInterval, TimeSpan.FromHours(1), TimeSpan.FromHours(10)}),
                        new KeyValuePair<string, List<object>>("RefreshInterval", new List<object>{defaultRefreshInterval, TimeSpan.FromHours(1), TimeSpan.FromHours(10)}),
                    },
                    Object = configManager,
                };

            TestUtilities.GetSet(context);
            TestUtilities.AssertFailIfErrors(MethodInfo.GetCurrentMethod().Name, context.Errors);

            TestUtilities.SetGet(configManager, "AutomaticRefreshInterval", TimeSpan.FromMilliseconds(1), ExpectedException.ArgumentOutOfRangeException(substringExpected: "IDX10107:"));
            TestUtilities.SetGet(configManager, "RefreshInterval", TimeSpan.FromMilliseconds(1), ExpectedException.ArgumentOutOfRangeException(substringExpected: "IDX10106:"));
            TestUtilities.SetGet(configManager, "RefreshInterval", Timeout.InfiniteTimeSpan, ExpectedException.ArgumentOutOfRangeException(substringExpected: "IDX10106:"));

            // AutomaticRefreshInterval interval should return same config.
            OpenIdConnectConfiguration configuration = configManager.GetConfigurationAsync().Result;
            TestUtilities.SetField(configManager, "_metadataAddress", "OpenIdConnectMetadata2.json");
            OpenIdConnectConfiguration configuration2 = configManager.GetConfigurationAsync().Result;
            Assert.IsTrue(IdentityComparer.AreEqual<OpenIdConnectConfiguration>(configuration, configuration2));
            Assert.IsTrue(object.ReferenceEquals(configuration, configuration2));

            // AutomaticRefreshInterval should pick up new bits.
            configManager = new ConfigurationManager<OpenIdConnectConfiguration>("OpenIdConnectMetadata.json");
            TestUtilities.SetField(configManager, "_automaticRefreshInterval", TimeSpan.FromMilliseconds(1));
            configuration = configManager.GetConfigurationAsync().Result;
            Thread.Sleep(1);
            TestUtilities.SetField(configManager, "_metadataAddress", "OpenIdConnectMetadata2.json");
            configuration2 = configManager.GetConfigurationAsync().Result;
            Assert.IsFalse(IdentityComparer.AreEqual<OpenIdConnectConfiguration>(configuration, configuration2));
            Assert.IsFalse(object.ReferenceEquals(configuration, configuration2));

            // RefreshInterval is set to MaxValue
            configManager = new ConfigurationManager<OpenIdConnectConfiguration>("OpenIdConnectMetadata.json");
            configuration = configManager.GetConfigurationAsync().Result;
            configManager.RefreshInterval = TimeSpan.MaxValue;
            TestUtilities.SetField(configManager, "_metadataAddress", "OpenIdConnectMetadata2.json");
            configuration2 = configManager.GetConfigurationAsync().Result;
            Assert.IsTrue(IdentityComparer.AreEqual<OpenIdConnectConfiguration>(configuration, configuration2));
            Assert.IsTrue(object.ReferenceEquals(configuration, configuration2));

            // Refresh should have no effect
            configManager = new ConfigurationManager<OpenIdConnectConfiguration>("OpenIdConnectMetadata.json");
            configuration = configManager.GetConfigurationAsync().Result;
            configManager.RefreshInterval = TimeSpan.FromHours(10);
            configManager.RequestRefresh();
            configuration2 = configManager.GetConfigurationAsync().Result;
            Assert.IsTrue(IdentityComparer.AreEqual<OpenIdConnectConfiguration>(configuration, configuration2));
            Assert.IsTrue(object.ReferenceEquals(configuration, configuration2));

            // Refresh should force pickup of new config
            configManager = new ConfigurationManager<OpenIdConnectConfiguration>("OpenIdConnectMetadata.json");
            configuration = configManager.GetConfigurationAsync().Result;
            TestUtilities.SetField(configManager, "_refreshInterval", TimeSpan.FromMilliseconds(1));
            Thread.Sleep(1);
            configManager.RequestRefresh();
            TestUtilities.SetField(configManager, "_metadataAddress", "OpenIdConnectMetadata2.json");
            configuration2 = configManager.GetConfigurationAsync().Result;
            Assert.IsFalse(object.ReferenceEquals(configuration, configuration2));
            Assert.IsFalse(IdentityComparer.AreEqual<OpenIdConnectConfiguration>(configuration, configuration2));

            // Refresh set to MaxValue
            configManager.RefreshInterval = TimeSpan.MaxValue;
            configuration = configManager.GetConfigurationAsync().Result;
            Assert.IsTrue(object.ReferenceEquals(configuration, configuration2));
            Assert.IsTrue(IdentityComparer.AreEqual<OpenIdConnectConfiguration>(configuration, configuration2));
        }