Example #1
0
        protected override string GetConfiguration(string variationId)
        {
            ExpectedJwtSecurityTokenRequirement variation = JwtHandlerConfigVariation.Variation(variationId);
            string config = @"<system.identityModel><identityConfiguration><securityTokenHandlers>"
                            + variation.Config
                            + @"</securityTokenHandlers></identityConfiguration></system.identityModel>";

            Console.WriteLine(string.Format("\n===================================\nTesting variation: '{0}'\nConfig:\n{1}", variationId, config));

            return(config);
        }
Example #2
0
        protected override void ValidateTestCase(string variationId)
        {
            ExpectedJwtSecurityTokenRequirement variation = JwtHandlerConfigVariation.Variation(variationId);

            try
            {
                IdentityConfiguration identityConfig = new IdentityConfiguration(IdentityConfiguration.DefaultServiceName);
                variation.ExpectedException.ProcessNoException();
                VerifyConfig(identityConfig, variation);
            }
            catch (Exception ex)
            {
                try
                {
                    variation.ExpectedException.ProcessException(ex);
                }
                catch (Exception innerException)
                {
                    Assert.Fail("\nConfig case failed:\n'{0}'\nConfig:\n'{1}'\nException:\n'{2}'.", variationId, variation.Config, innerException.ToString());
                }
            }
        }
Example #3
0
        private void VerifyConfig(IdentityConfiguration identityconfig, ExpectedJwtSecurityTokenRequirement variation)
        {
            JwtSecurityTokenHandler handler = identityconfig.SecurityTokenHandlers[typeof(JwtSecurityToken)] as JwtSecurityTokenHandler;

            Assert.IsFalse(!variation.AsExpected(handler.JwtSecurityTokenRequirement), "JwtSecurityTokenRequirement was not as expected");
        }
 private void VerifyConfig(IdentityConfiguration identityconfig, ExpectedJwtSecurityTokenRequirement variation)
 {
     JwtSecurityTokenHandler handler = identityconfig.SecurityTokenHandlers[typeof(JwtSecurityToken)] as JwtSecurityTokenHandler;
     Assert.IsFalse(!variation.AsExpected(handler.JwtSecurityTokenRequirement), "JwtSecurityTokenRequirement was not as expected");
 }