File tree Expand file tree Collapse file tree 7 files changed +56
-15
lines changed
Infrastructure/Extensions Expand file tree Collapse file tree 7 files changed +56
-15
lines changed Original file line number Diff line number Diff line change 1313 </PropertyGroup >
1414
1515 <ItemGroup >
16- <PackageReference Include =" Roslynator.Analyzers" Version =" 4.12.4 " >
16+ <PackageReference Include =" Roslynator.Analyzers" Version =" 4.12.9 " >
1717 <PrivateAssets >all</PrivateAssets >
1818 <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
1919 </PackageReference >
Original file line number Diff line number Diff line change @@ -38,16 +38,41 @@ public class JwtOptions
3838 public string ? ValidIssuer { get ; set ; }
3939 public IEnumerable < string > ? ValidIssuers { get ; set ; }
4040 public bool ValidateActor { get ; set ; }
41+
42+ /// <summary>
43+ /// It defines whether the audience should be validated.
44+ /// Defaults to true.
45+ /// </summary>
4146 public bool ValidateAudience { get ; set ; } = true ;
47+
48+ /// <summary>
49+ /// It defines whether the issuer should be validated.
50+ /// Defaults to true.
51+ /// </summary>
4252 public bool ValidateIssuer { get ; set ; } = true ;
4353 public bool ValidateLifetime { get ; set ; } = true ;
4454 public bool ValidateTokenReplay { get ; set ; }
4555 public bool ValidateIssuerSigningKey { get ; set ; }
56+
57+ /// <summary>
58+ /// It defines whether the token should be refreshed when the issuer key is not found.
59+ /// Defaults to true.
60+ /// </summary>
4661 public bool RefreshOnIssuerKeyNotFound { get ; set ; } = true ;
62+
63+ /// <summary>
64+ /// It defines whether the error details should be included in the response.
65+ /// Defaults to true.
66+ /// </summary>
4767 public bool IncludeErrorDetails { get ; set ; } = true ;
4868 public string ? AuthenticationType { get ; set ; }
4969 public string ? NameClaimType { get ; set ; }
50- public string ? RoleClaimType { get ; set ; }
70+
71+ /// <summary>
72+ /// The claim type that will be used to determine the user's roles.
73+ /// Defaults to "Role".
74+ /// </summary>
75+ public string RoleClaimType { get ; set ; } = "Role" ;
5176
5277 public class CertificateOptions
5378 {
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ private static IGenocsBuilder AddJwt(
7070 SaveSigninToken = options . SaveSigninToken ,
7171 RequireExpirationTime = options . RequireExpirationTime ,
7272 RequireSignedTokens = options . RequireSignedTokens ,
73+ RoleClaimType = options . RoleClaimType ,
7374 ClockSkew = TimeSpan . Zero
7475 } ;
7576
@@ -117,6 +118,7 @@ private static IGenocsBuilder AddJwt(
117118 }
118119 }
119120
121+ // If no certificate is provided, use symmetric encryption.
120122 if ( ! string . IsNullOrWhiteSpace ( options . IssuerSigningKey ) && ! hasCertificate )
121123 {
122124 if ( string . IsNullOrWhiteSpace ( options . Algorithm ) || hasCertificate )
Original file line number Diff line number Diff line change @@ -65,14 +65,16 @@ public static IServiceCollection AddCustomMassTransit(this IServiceCollection se
6565 x . UsingRabbitMq ( ( context , cfg ) =>
6666 {
6767 cfg . ConfigureEndpoints ( context ) ;
68- //cfg.UseHealthCheck(context);
69- cfg . Host ( rabbitMQSettings . HostName , rabbitMQSettings . VirtualHost ,
70- h =>
71- {
72- h . Username ( rabbitMQSettings . UserName ) ;
73- h . Password ( rabbitMQSettings . Password ) ;
74- }
75- ) ;
68+
69+ // cfg.UseHealthCheck(context);
70+ cfg . Host (
71+ rabbitMQSettings . HostName ,
72+ rabbitMQSettings . VirtualHost ,
73+ h =>
74+ {
75+ h . Username ( rabbitMQSettings . UserName ) ;
76+ h . Password ( rabbitMQSettings . Password ) ;
77+ } ) ;
7678 } ) ;
7779 } ) ;
7880
Original file line number Diff line number Diff line change 88using Genocs . Tracing ;
99using Microsoft . Extensions . Diagnostics . HealthChecks ;
1010using Serilog ;
11+ using Genocs . Auth ;
1112using System . Reflection ;
1213using System . Text . Json . Serialization ;
1314
2324
2425services
2526 . AddGenocs ( builder . Configuration )
27+ . AddJwt ( )
2628// .AddOpenIdJwt()
2729 . AddOpenTelemetry ( )
2830 . AddMongoFast ( )
Original file line number Diff line number Diff line change 3232 "ValidAudience" : " https://localhost:5000" ,
3333 "Secret" : " "
3434 },
35+ "_simmetric_jwt" : {
36+ "issuerSigningKey" : " This is my custom Secret key for authentication S0M3RAN0MS3CR3T!1!MAG1C!1!" ,
37+ "requireHttpsMetadata" : false ,
38+ "saveToken" : true ,
39+ "validateIssuerSigningKey" : true ,
40+ "validateIssuer" : false ,
41+ "validateLifetime" : true ,
42+ "validateAudience" : false ,
43+ "roleClaimType" : " Role"
44+ },
3545 "rabbitMQ" : {
3646 "HostName" : " localhost" ,
3747 "VirtualHost" : " /" ,
5363 "enableTracing" : true
5464 },
5565 "azureKeyVault" : {
56- "enabled" : true ,
66+ "enabled" : false ,
5767 "name" : " kv-genocs"
5868 },
5969 "secrets" : {
Original file line number Diff line number Diff line change 5151
5252 <ItemGroup >
5353 <PackageReference Include =" Figgle" Version =" 0.5.1" />
54- <PackageReference Include =" Scrutor" Version =" 4.2.2 " />
54+ <PackageReference Include =" Scrutor" Version =" 5.0.1 " />
5555 </ItemGroup >
5656
5757 <ItemGroup Condition =" '$(TargetFramework)' == 'net8.0'" >
6868
6969 <ItemGroup Condition =" '$(TargetFramework)' == 'netstandard2.1'" >
7070 <PackageReference Include =" Microsoft.AspNetCore.Http.Abstractions" Version =" 2.2.0" />
71- <PackageReference Include =" Microsoft.Extensions.Caching.Memory" Version =" 8.0.0 " />
71+ <PackageReference Include =" Microsoft.Extensions.Caching.Memory" Version =" 8.0.1 " />
7272 <PackageReference Include =" Microsoft.Extensions.Configuration.Abstractions" Version =" 8.0.0" />
7373 <PackageReference Include =" Microsoft.Extensions.Configuration.Binder" Version =" 8.0.2" />
74- <PackageReference Include =" Microsoft.Extensions.DependencyInjection" Version =" 7 .0.0 " />
74+ <PackageReference Include =" Microsoft.Extensions.DependencyInjection" Version =" 8 .0.1 " />
7575 <PackageReference Include =" System.ComponentModel.Annotations" Version =" 5.0.0" />
76- <PackageReference Include =" System.Text.Json" Version =" 8.0.4 " />
76+ <PackageReference Include =" System.Text.Json" Version =" 8.0.5 " />
7777 </ItemGroup >
7878</Project >
You can’t perform that action at this time.
0 commit comments