File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
common/Http.Connections/test Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 13
13
using System . Net . Http ;
14
14
using System . Net . WebSockets ;
15
15
using System . Security . Claims ;
16
+ using System . Security . Cryptography ;
16
17
using System . Security . Principal ;
17
18
using System . Text ;
18
19
using System . Threading ;
@@ -2762,7 +2763,7 @@ public async Task ConnectionClosedRequestedTriggeredOnAuthExpiration()
2762
2763
[ InlineData ( HttpTransportType . WebSockets ) ]
2763
2764
public async Task AuthenticationExpirationSetOnAuthenticatedConnectionWithJWT ( HttpTransportType transportType )
2764
2765
{
2765
- SymmetricSecurityKey SecurityKey = new SymmetricSecurityKey ( Guid . NewGuid ( ) . ToByteArray ( ) ) ;
2766
+ SymmetricSecurityKey SecurityKey = new SymmetricSecurityKey ( SHA256 . HashData ( Guid . NewGuid ( ) . ToByteArray ( ) ) ) ;
2766
2767
JwtSecurityTokenHandler JwtTokenHandler = new JwtSecurityTokenHandler ( ) ;
2767
2768
2768
2769
using var host = CreateHost ( services =>
@@ -2924,7 +2925,7 @@ public async Task AuthenticationExpirationSetOnAuthenticatedConnectionWithCookie
2924
2925
[ InlineData ( HttpTransportType . WebSockets ) ]
2925
2926
public async Task AuthenticationExpirationUsesCorrectScheme ( HttpTransportType transportType )
2926
2927
{
2927
- var SecurityKey = new SymmetricSecurityKey ( Guid . NewGuid ( ) . ToByteArray ( ) ) ;
2928
+ var SecurityKey = new SymmetricSecurityKey ( SHA256 . HashData ( Guid . NewGuid ( ) . ToByteArray ( ) ) ) ;
2928
2929
var JwtTokenHandler = new JwtSecurityTokenHandler ( ) ;
2929
2930
2930
2931
using var host = CreateHost ( services =>
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ namespace JwtSample
18
18
{
19
19
public class Startup
20
20
{
21
- private readonly SymmetricSecurityKey SecurityKey = new SymmetricSecurityKey ( RandomNumberGenerator . GetBytes ( 16 ) ) ;
21
+ private readonly SymmetricSecurityKey SecurityKey = new SymmetricSecurityKey ( RandomNumberGenerator . GetBytes ( 32 ) ) ;
22
22
private readonly JwtSecurityTokenHandler JwtTokenHandler = new JwtSecurityTokenHandler ( ) ;
23
23
24
24
public void ConfigureServices ( IServiceCollection services )
Original file line number Diff line number Diff line change 5
5
using System . IdentityModel . Tokens . Jwt ;
6
6
using System . IO ;
7
7
using System . Security . Claims ;
8
+ using System . Security . Cryptography ;
8
9
using System . Threading . Tasks ;
9
10
using Microsoft . AspNetCore . Authentication . JwtBearer ;
10
11
using Microsoft . AspNetCore . Authorization ;
@@ -18,7 +19,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
18
19
{
19
20
public class Startup
20
21
{
21
- private readonly SymmetricSecurityKey SecurityKey = new SymmetricSecurityKey ( Guid . NewGuid ( ) . ToByteArray ( ) ) ;
22
+ private readonly SymmetricSecurityKey SecurityKey = new SymmetricSecurityKey ( SHA256 . HashData ( Guid . NewGuid ( ) . ToByteArray ( ) ) ) ;
22
23
private readonly JwtSecurityTokenHandler JwtTokenHandler = new JwtSecurityTokenHandler ( ) ;
23
24
24
25
public void ConfigureServices ( IServiceCollection services )
You can’t perform that action at this time.
0 commit comments