Skip to content

Commit afe8269

Browse files
committed
fix: options at extension method
1 parent 1fb1a8b commit afe8269

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/NetDevPack.Identity/JwtBuilderExtensions.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,32 @@
55
using NetDevPack.Identity.Data;
66
using NetDevPack.Identity.Interfaces;
77
using NetDevPack.Identity.Jwt;
8+
using NetDevPack.Security.Jwt.Core;
89
using NetDevPack.Security.Jwt.Core.Interfaces;
910

1011
namespace Microsoft.Extensions.DependencyInjection;
1112

1213
public static class JwtBuilderExtensions
1314
{
14-
public static IJwksBuilder AddNetDevPackIdentity<TIdentityUser, TKey>(this IServiceCollection services) where TIdentityUser : IdentityUser<TKey> where TKey : IEquatable<TKey>
15+
public static IJwksBuilder AddNetDevPackIdentity<TIdentityUser, TKey>(this IServiceCollection services, Action<JwtOptions> options = null)
16+
where TIdentityUser : IdentityUser<TKey> where TKey : IEquatable<TKey>
1517
{
1618
services.AddDataProtection();
1719
services.AddScoped<IJwtBuilder, JwtBuilderInject<TIdentityUser, TKey>>();
1820
return services.AddHttpContextAccessor().AddJwksManager();
1921
}
20-
public static IJwksBuilder AddNetDevPackIdentity<TIdentityUser>(this IServiceCollection services) where TIdentityUser : IdentityUser
22+
public static IJwksBuilder AddNetDevPackIdentity<TIdentityUser>(this IServiceCollection services, Action<JwtOptions> options = null)
23+
where TIdentityUser : IdentityUser
2124
{
2225
services.AddDataProtection();
2326
services.AddScoped<IJwtBuilder, JwtBuilderInject<TIdentityUser, string>>();
2427
return services.AddHttpContextAccessor().AddJwksManager();
2528
}
26-
public static IJwksBuilder AddNetDevPackIdentity(this IServiceCollection services)
29+
public static IJwksBuilder AddNetDevPackIdentity(this IServiceCollection services, Action<JwtOptions> options = null)
2730
{
2831
services.AddDataProtection();
2932
services.AddScoped<IJwtBuilder, JwtBuilderInject<IdentityUser, string>>();
30-
return services.AddHttpContextAccessor().AddJwksManager();
33+
return services.AddHttpContextAccessor().AddJwksManager(options);
3134
}
3235

3336
public static IdentityBuilder AddIdentityConfiguration(this IServiceCollection services)

0 commit comments

Comments
 (0)