Skip to content

Commit

Permalink
Adding end to end tests and doc for the new validation (#3077)
Browse files Browse the repository at this point in the history
* Adding end to end tests

* Update
  • Loading branch information
jmprieur authored Jan 7, 2025
1 parent 27aa6e1 commit 6df18f5
Show file tree
Hide file tree
Showing 5 changed files with 767 additions and 68 deletions.
249 changes: 196 additions & 53 deletions src/Microsoft.IdentityModel.Tokens/Validation/AsyncValidate.cd
Original file line number Diff line number Diff line change
@@ -1,81 +1,224 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Class Name="Microsoft.IdentityModel.Tokens.TokenValidationResult" Collapsed="true">
<Position X="7.75" Y="7" Width="3.25" />
<ClassDiagram MajorVersion="1" MinorVersion="1" MembersFormat="FullSignature">
<Class Name="Microsoft.IdentityModel.Tokens.CallContext">
<Position X="16" Y="4" Width="3.5" />
<InheritanceLine Type="Microsoft.IdentityModel.Logging.LoggerContext" FixedToPoint="true">
<Path>
<Point X="17.625" Y="3.267" />
<Point X="17.625" Y="4" />
</Path>
</InheritanceLine>
<TypeIdentifier>
<HashCode>ABEAIAABEEAAEAIAAAAAAAABEQAAAEEACABAAAAkIoA=</HashCode>
<FileName>Validation\TokenValidationResult.cs</FileName>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>CallContext.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.IssuerValidationResult">
<Position X="12.5" Y="7" Width="2.25" />
<Class Name="Microsoft.IdentityModel.Logging.LoggerContext">
<Position X="15.75" Y="0.75" Width="3.75" />
<TypeIdentifier />
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.AlgorithmValidationError">
<Position X="5.25" Y="12.75" Width="2.75" />
<Members>
<Method Name="AlgorithmValidationError" Hidden="true" />
<Method Name="GetException" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AAEAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAA=</HashCode>
<FileName>Validation\IssuerValidationResult.cs</FileName>
<HashCode>AAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAA=</HashCode>
<FileName>Validation\Results\Details\AlgorithmValidationError.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.ExceptionDetail">
<Position X="6.25" Y="0.5" Width="1.5" />
<Class Name="Microsoft.IdentityModel.Tokens.ValidationError">
<Position X="9.5" Y="8" Width="6.5" />
<Members>
<Field Name="_exceptionType" Hidden="true" />
<Property Name="CachedStackFrames" Hidden="true" />
<Method Name="GetException" Hidden="true" />
<Property Name="MessageDetail" Hidden="true" />
<Method Name="ValidationError" Hidden="true" />
</Members>
<NestedTypes>
<Class Name="Microsoft.IdentityModel.Tokens.ValidationError.Logger" Collapsed="true">
<TypeIdentifier>
<NewMemberFileName>Validation\Results\Details\ValidationError.cs</NewMemberFileName>
</TypeIdentifier>
</Class>
</NestedTypes>
<TypeIdentifier>
<HashCode>AAAEAAAAAAAAAAAAAAAAEAAEAAAAAAAAAEAABAAAAAA=</HashCode>
<FileName>Validation\ExceptionDetail.cs</FileName>
<HashCode>AQAEAAAIAAAAAAACAAAAGAAEAAwAAAAQBEAAJAAAAAA=</HashCode>
<FileName>Validation\Results\Details\ValidationError.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="MessageDetail" />
</ShowAsAssociation>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.ValidationResult">
<Position X="8.5" Y="3.5" Width="3.5" />
<Class Name="Microsoft.IdentityModel.Tokens.AudienceValidationError">
<Position X="8.25" Y="12.75" Width="3" />
<InheritanceLine Type="Microsoft.IdentityModel.Tokens.ValidationError" FixedToPoint="true">
<Path>
<Point X="12.75" Y="11.353" />
<Point X="12.75" Y="12.375" />
<Point X="9.75" Y="12.375" />
<Point X="9.75" Y="12.75" />
</Path>
</InheritanceLine>
<TypeIdentifier>
<HashCode>AIAAAAJAAAAAAAAAAAgAIAABAAgAAAAABEBBAAAAAAA=</HashCode>
<FileName>Validation\ValidationResult.cs</FileName>
<HashCode>AAAEAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAEAA=</HashCode>
<FileName>Validation\Results\Details\AudienceValidationError.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="ExceptionDetail" />
<Property Name="CallContext" />
<Property Name="ValidationFailureType" />
</ShowAsAssociation>
<ShowAsCollectionAssociation>
<Property Name="LogDetails" />
</ShowAsCollectionAssociation>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.LogDetail">
<Position X="12" Y="0.5" Width="1.5" />
<Class Name="Microsoft.IdentityModel.Tokens.IssuerSigningKeyValidationError">
<Position X="11.5" Y="12.75" Width="3.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAA=</HashCode>
<FileName>Validation\LogDetail.cs</FileName>
<HashCode>AAAEAAAIAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Validation\Results\Details\IssuerSigningKeyValidationError.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="MessageDetail" />
</ShowAsAssociation>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.ValidationFailureType" Collapsed="true">
<Position X="13.5" Y="5.5" Width="2.5" />
<Compartments>
<Compartment Name="Nested Types" Collapsed="false" />
</Compartments>
<Class Name="Microsoft.IdentityModel.Tokens.IssuerValidationError">
<Position X="15" Y="12.75" Width="2.5" />
<TypeIdentifier>
<HashCode>AAAIAAAAAAAAAAAAAAIAAAQAAABAQAAAAAAAAAAAAAA=</HashCode>
<FileName>Validation\ValidationFailureType.cs</FileName>
<HashCode>AAAEAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Validation\Results\Details\IssuerValidationError.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.MessageDetail">
<Position X="9.25" Y="0.5" Width="1.5" />
<Class Name="Microsoft.IdentityModel.Tokens.LifetimeValidationError">
<Position X="17.75" Y="12.75" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAEIAAIAAAAAA=</HashCode>
<FileName>Validation\MessageDetail.cs</FileName>
<HashCode>AAAEAAAAAAAAAIAAAAAAAAAAAAAAAAAAIAAAAAAAAAA=</HashCode>
<FileName>Validation\Results\Details\LifetimeValidationError.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.CallContext" Collapsed="true">
<Position X="13.5" Y="4.5" Width="1.5" />
<Class Name="Microsoft.IdentityModel.Tokens.SignatureValidationError">
<Position X="20.25" Y="12.75" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>CallContext.cs</FileName>
<HashCode>AAAEAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Validation\Results\Details\SignatureValidationError.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Microsoft.IdentityModel.Logging.LoggerContext" Collapsed="true">
<Position X="15.5" Y="4.5" Width="1.5" />
<TypeIdentifier />
<Class Name="Microsoft.IdentityModel.Tokens.TokenReplayValidationError">
<Position X="22.75" Y="12.75" Width="2.75" />
<TypeIdentifier>
<HashCode>AAAEAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAA=</HashCode>
<FileName>Validation\Results\Details\TokenReplayValidationError.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.TokenTypeValidationError">
<Position X="25.75" Y="12.75" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAEQAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Validation\Results\Details\TokenTypeValidationError.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.ValidatedToken">
<Position X="5" Y="16.75" Width="4.25" />
<Members>
<Field Name="_claims" Hidden="true" />
<Field Name="_claimsIdentity" Hidden="true" />
<Field Name="_claimsIdentityInitialized" Hidden="true" />
<Field Name="_claimsIdentitySyncObj" Hidden="true" />
<Property Name="ClaimsIdentitySyncObj" Hidden="true" />
</Members>
<NestedTypes>
<Class Name="Microsoft.IdentityModel.Tokens.ValidatedToken.Logger" Collapsed="true">
<TypeIdentifier>
<NewMemberFileName>Validation\Results\ValidatedToken.cs</NewMemberFileName>
</TypeIdentifier>
</Class>
</NestedTypes>
<AssociationLine Name="ValidatedIssuer" Type="Microsoft.IdentityModel.Tokens.ValidatedIssuer" FixedFromPoint="true" FixedToPoint="true">
<Path>
<Point X="9.25" Y="17.591" />
<Point X="9.625" Y="17.591" />
<Point X="9.625" Y="16.062" />
<Point X="11" Y="16.062" />
</Path>
</AssociationLine>
<TypeIdentifier>
<HashCode>ACAAIAAAAEAAACIIAAAQAAEAARgACEEACIAAACAgQIA=</HashCode>
<FileName>Validation\Results\ValidatedToken.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="ActorValidationResult" />
<Property Name="ValidatedIssuer" />
<Property Name="ValidatedLifetime" />
<Property Name="ValidatedSigningKeyLifetime" />
<Property Name="ValidatedTokenType" />
</ShowAsAssociation>
</Class>
<Struct Name="Microsoft.IdentityModel.Tokens.ValidationResult&lt;TResult&gt;">
<Position X="4" Y="8" Width="3.75" />
<Members>
<Field Name="_error" Hidden="true" />
<Field Name="_result" Hidden="true" />
<Method Name="implicit operator ValidationResult&lt;TResult&gt;" Hidden="true" />
<Method Name="operator !=" Hidden="true" />
<Method Name="operator ==" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAQACgAgAAEQBAAACIIAAABAAAAAAAiA=</HashCode>
<FileName>Validation\Results\ValidationResult.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="Error" />
</ShowAsAssociation>
<Lollipop Position="0.2" />
</Struct>
<Struct Name="Microsoft.IdentityModel.Tokens.ValidatedIssuer">
<Position X="11" Y="15.75" Width="3.5" />
<Members>
<Method Name="Equals" Hidden="true" />
<Method Name="GetHashCode" Hidden="true" />
<Method Name="operator !=" Hidden="true" />
<Method Name="operator ==" Hidden="true" />
<Method Name="ValidatedIssuer" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AAEAAAAAAAEAAAAAgAAAAAAAAAAAAIAAAAAAAAAAAiA=</HashCode>
<FileName>Validation\Results\ValidatedIssuer.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Struct>
<Struct Name="Microsoft.IdentityModel.Tokens.ValidatedLifetime">
<Position X="11" Y="20.75" Width="3.75" />
<Members>
<Method Name="Equals" Hidden="true" />
<Method Name="GetHashCode" Hidden="true" />
<Method Name="operator !=" Hidden="true" />
<Method Name="operator ==" Hidden="true" />
<Method Name="ValidatedLifetime" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAIAAgAAAAAAAAAAAAIAAIAAAAAAAAiA=</HashCode>
<FileName>Validation\Results\ValidatedLifetime.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Struct>
<Struct Name="Microsoft.IdentityModel.Tokens.ValidatedSigningKeyLifetime">
<Position X="11" Y="17.25" Width="3.25" />
<Members>
<Method Name="Equals" Hidden="true" />
<Method Name="GetHashCode" Hidden="true" />
<Method Name="operator !=" Hidden="true" />
<Method Name="operator ==" Hidden="true" />
<Method Name="ValidatedSigningKeyLifetime" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAgAAAAAAAAAgAAKAAACAAAAAAAiA=</HashCode>
<FileName>Validation\Results\ValidatedSigningKeyLifetime.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Struct>
<Struct Name="Microsoft.IdentityModel.Tokens.ValidatedTokenType">
<Position X="11" Y="19" Width="3.25" />
<Members>
<Method Name="Equals" Hidden="true" />
<Method Name="GetHashCode" Hidden="true" />
<Method Name="operator !=" Hidden="true" />
<Method Name="operator ==" Hidden="true" />
<Method Name="ValidatedTokenType" Hidden="true" />
</Members>
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAgAAAACAAAAAAAIAAAQAAAAAAAiA=</HashCode>
<FileName>Validation\Results\ValidatedTokenType.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Struct>
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>
16 changes: 3 additions & 13 deletions src/Microsoft.IdentityModel.Tokens/Validation/Exceptions.cd
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,23 @@
<Class Name="Microsoft.IdentityModel.Tokens.SecurityTokenException">
<Position X="6.25" Y="1.25" Width="2.5" />
<TypeIdentifier>
<HashCode>AIAAAAAAAgAAAgAAAAQAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<HashCode>AAAAAAAAAoAAAgAAAAQAAAAAAAAAAAAAAEAAAAAAAAA=</HashCode>
<FileName>Exceptions\SecurityTokenException.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="ExceptionDetail" />
</ShowAsAssociation>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.SecurityTokenValidationException" Collapsed="true">
<Position X="6.5" Y="4" Width="2.25" />
<Position X="6.25" Y="4.5" Width="2.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Exceptions\SecurityTokenValidationException.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.SecurityTokenInvalidIssuerException">
<Position X="6.25" Y="5.25" Width="2.75" />
<Position X="6.25" Y="5.75" Width="2.5" />
<TypeIdentifier>
<HashCode>AAgAAEAAAAAAAAAAAAACAAAgAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Exceptions\SecurityTokenInvalidIssuerException.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Microsoft.IdentityModel.Tokens.ExceptionDetail">
<Position X="10.25" Y="1.25" Width="1.75" />
<TypeIdentifier>
<HashCode>AAAEAAAAAAAAAAAAAAAAEAAEAAAAAAAAAEAABAAAAAA=</HashCode>
<FileName>Validation\ExceptionDetail.cs</FileName>
</TypeIdentifier>
</Class>
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>
Loading

0 comments on commit 6df18f5

Please sign in to comment.