File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
src/Security/Authentication/test Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -972,7 +972,7 @@ public async Task ExpirationAndIssuedWhenMinOrMaxValue()
972972 issuer : "issuer.contoso.com" ,
973973 audience : "audience.contoso.com" ,
974974 claims : claims ,
975- expires : DateTime . MaxValue ,
975+ expires : new DateTime ( DateTime . MaxValue . Ticks , DateTimeKind . Utc ) ,
976976 signingCredentials : creds ) ;
977977
978978 var tokenText = new JwtSecurityTokenHandler ( ) . WriteToken ( token ) ;
@@ -1000,8 +1000,7 @@ public async Task ExpirationAndIssuedWhenMinOrMaxValue()
10001000 var expiresElement = dom . RootElement . GetProperty ( "expires" ) ;
10011001 Assert . Equal ( JsonValueKind . String , expiresElement . ValueKind ) ;
10021002
1003- var elementValue = DateTime . Parse ( expiresElement . GetString ( ) , CultureInfo . InvariantCulture ) ;
1004- var elementValueUtc = elementValue . ToUniversalTime ( ) ;
1003+ var elementValueUtc = DateTime . Parse ( expiresElement . GetString ( ) , CultureInfo . InvariantCulture , DateTimeStyles . AdjustToUniversal ) ;
10051004 // roundtrip DateTime.MaxValue through parsing because it is lossy and we
10061005 // need equivalent values to compare against.
10071006 var max = DateTime . Parse ( DateTime . MaxValue . ToString ( CultureInfo . InvariantCulture ) , CultureInfo . InvariantCulture ) ;
Original file line number Diff line number Diff line change @@ -917,7 +917,7 @@ public async Task ExpirationAndIssuedWhenMinOrMaxValue()
917917 issuer : "issuer.contoso.com" ,
918918 audience : "audience.contoso.com" ,
919919 claims : claims ,
920- expires : DateTime . MaxValue ,
920+ expires : new DateTime ( DateTime . MaxValue . Ticks , DateTimeKind . Utc ) ,
921921 signingCredentials : creds ) ;
922922
923923 var tokenText = new JwtSecurityTokenHandler ( ) . WriteToken ( token ) ;
@@ -944,8 +944,7 @@ public async Task ExpirationAndIssuedWhenMinOrMaxValue()
944944 var expiresElement = dom . RootElement . GetProperty ( "expires" ) ;
945945 Assert . Equal ( JsonValueKind . String , expiresElement . ValueKind ) ;
946946
947- var elementValue = DateTime . Parse ( expiresElement . GetString ( ) , CultureInfo . InvariantCulture ) ;
948- var elementValueUtc = elementValue . ToUniversalTime ( ) ;
947+ var elementValueUtc = DateTime . Parse ( expiresElement . GetString ( ) , CultureInfo . InvariantCulture , DateTimeStyles . AdjustToUniversal ) ;
949948 // roundtrip DateTime.MaxValue through parsing because it is lossy and we
950949 // need equivalent values to compare against.
951950 var max = DateTime . Parse ( DateTime . MaxValue . ToString ( CultureInfo . InvariantCulture ) , CultureInfo . InvariantCulture ) ;
You can’t perform that action at this time.
0 commit comments