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 ;
@@ -2818,7 +2819,7 @@ public async Task ConnectionClosedRequestedTriggeredOnAuthExpiration()
2818
2819
[ InlineData ( HttpTransportType . WebSockets ) ]
2819
2820
public async Task AuthenticationExpirationSetOnAuthenticatedConnectionWithJWT ( HttpTransportType transportType )
2820
2821
{
2821
- SymmetricSecurityKey SecurityKey = new SymmetricSecurityKey ( Guid . NewGuid ( ) . ToByteArray ( ) ) ;
2822
+ SymmetricSecurityKey SecurityKey = new SymmetricSecurityKey ( SHA256 . HashData ( Guid . NewGuid ( ) . ToByteArray ( ) ) ) ;
2822
2823
JwtSecurityTokenHandler JwtTokenHandler = new JwtSecurityTokenHandler ( ) ;
2823
2824
2824
2825
using var host = CreateHost ( services =>
@@ -2980,7 +2981,7 @@ public async Task AuthenticationExpirationSetOnAuthenticatedConnectionWithCookie
2980
2981
[ InlineData ( HttpTransportType . WebSockets ) ]
2981
2982
public async Task AuthenticationExpirationUsesCorrectScheme ( HttpTransportType transportType )
2982
2983
{
2983
- var SecurityKey = new SymmetricSecurityKey ( Guid . NewGuid ( ) . ToByteArray ( ) ) ;
2984
+ var SecurityKey = new SymmetricSecurityKey ( SHA256 . HashData ( Guid . NewGuid ( ) . ToByteArray ( ) ) ) ;
2984
2985
var JwtTokenHandler = new JwtSecurityTokenHandler ( ) ;
2985
2986
2986
2987
using var host = CreateHost ( services =>
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ namespace JwtSample;
11
11
12
12
public class Startup
13
13
{
14
- private readonly SymmetricSecurityKey SecurityKey = new SymmetricSecurityKey ( RandomNumberGenerator . GetBytes ( 16 ) ) ;
14
+ private readonly SymmetricSecurityKey SecurityKey = new SymmetricSecurityKey ( RandomNumberGenerator . GetBytes ( 32 ) ) ;
15
15
private readonly JwtSecurityTokenHandler JwtTokenHandler = new JwtSecurityTokenHandler ( ) ;
16
16
17
17
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