public void JwtSecurityTokenHandler_Defaults() { JwtSecurityTokenHandler handler = new JwtSecurityTokenHandler(); Assert.IsTrue(handler.CanValidateToken, "!handler.CanValidateToken"); Assert.IsTrue(handler.CanWriteToken, "!handler.CanWriteToken"); Assert.IsNotNull(handler.SignatureProviderFactory, "handler.SignatureProviderFactory == null"); Assert.AreEqual(handler.TokenType, typeof(JwtSecurityToken), "handler.TokenType != typeof(JwtSecurityToken)"); try { handler.CreateSecurityTokenReference(new JwtSecurityToken(), false); } catch (NotSupportedException) { } string[] tokenIdentifiers = handler.GetTokenTypeIdentifiers(); Assert.AreEqual(tokenIdentifiers.Length, 2, "tokenIdentifiers.Length != 2 "); // this seemly simple order will break WebSSO if the first type is not an absolute URI Assert.AreEqual(tokenIdentifiers[0], JwtConstants.TokenTypeAlt, "tokenIdentifiers[0] != JwtConstants.TokenTypeAlt "); Uri result = null; Assert.IsTrue(Uri.TryCreate(tokenIdentifiers[0], UriKind.Absolute, out result), "tokenIdentifiers[0] must be able to create an UriKind.Absolute"); Assert.AreEqual(tokenIdentifiers[1], JwtConstants.TokenType, "tokenIdentifiers[1] != JwtConstants.TokenType"); }