public void DecodeHeader_Should_Return_Header() { const string token = TestData.TokenByAsymmetricAlgorithm; var serializer = new JsonNetSerializer(); var urlEncoder = new JwtBase64UrlEncoder(); var decoder = new JwtDecoder(serializer, urlEncoder); var header = decoder.DecodeHeader(token); header.Should() .NotBeNullOrEmpty("because decoding header should be possible without validator or algorithm"); }
public void DecodeHeader_To_Dictionary_Should_Return_Header() { const string token = TestData.TokenByAsymmetricAlgorithm; var serializer = new JsonNetSerializer(); var urlEncoder = new JwtBase64UrlEncoder(); var decoder = new JwtDecoder(serializer, urlEncoder); var header = decoder.DecodeHeader <Dictionary <string, string> >(token); header.Should() .NotBeNull("because decoding header should be possible without validator or algorithm"); header.Should() .Contain("typ", "JWT") .And.Contain("alg", "RS256") .And.Contain("kid", TestData.ServerRsaPublicThumbprint1); }
public void DecodeHeader_To_JwtHeader_Should_Return_Header() { const string token = TestData.TokenByAsymmetricAlgorithm; var serializer = new JsonNetSerializer(); var urlEncoder = new JwtBase64UrlEncoder(); var decoder = new JwtDecoder(serializer, urlEncoder); var header = decoder.DecodeHeader <JwtHeader>(token); header.Should() .NotBeNull("because decoding header should be possible without validator or algorithm"); header.Type .Should() .Be("JWT"); header.Algorithm .Should() .Be("RS256"); header.KeyId .Should() .Be(TestData.ServerRsaPublicThumbprint1); }