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()
972
972
issuer : "issuer.contoso.com" ,
973
973
audience : "audience.contoso.com" ,
974
974
claims : claims ,
975
- expires : DateTime . MaxValue ,
975
+ expires : new DateTime ( DateTime . MaxValue . Ticks , DateTimeKind . Utc ) ,
976
976
signingCredentials : creds ) ;
977
977
978
978
var tokenText = new JwtSecurityTokenHandler ( ) . WriteToken ( token ) ;
@@ -1000,8 +1000,7 @@ public async Task ExpirationAndIssuedWhenMinOrMaxValue()
1000
1000
var expiresElement = dom . RootElement . GetProperty ( "expires" ) ;
1001
1001
Assert . Equal ( JsonValueKind . String , expiresElement . ValueKind ) ;
1002
1002
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 ) ;
1005
1004
// roundtrip DateTime.MaxValue through parsing because it is lossy and we
1006
1005
// need equivalent values to compare against.
1007
1006
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()
917
917
issuer : "issuer.contoso.com" ,
918
918
audience : "audience.contoso.com" ,
919
919
claims : claims ,
920
- expires : DateTime . MaxValue ,
920
+ expires : new DateTime ( DateTime . MaxValue . Ticks , DateTimeKind . Utc ) ,
921
921
signingCredentials : creds ) ;
922
922
923
923
var tokenText = new JwtSecurityTokenHandler ( ) . WriteToken ( token ) ;
@@ -944,8 +944,7 @@ public async Task ExpirationAndIssuedWhenMinOrMaxValue()
944
944
var expiresElement = dom . RootElement . GetProperty ( "expires" ) ;
945
945
Assert . Equal ( JsonValueKind . String , expiresElement . ValueKind ) ;
946
946
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 ) ;
949
948
// roundtrip DateTime.MaxValue through parsing because it is lossy and we
950
949
// need equivalent values to compare against.
951
950
var max = DateTime . Parse ( DateTime . MaxValue . ToString ( CultureInfo . InvariantCulture ) , CultureInfo . InvariantCulture ) ;
You can’t perform that action at this time.
0 commit comments