|
5 | 5 | using NetDevPack.Identity.Data; |
6 | 6 | using NetDevPack.Identity.Interfaces; |
7 | 7 | using NetDevPack.Identity.Jwt; |
| 8 | +using NetDevPack.Security.Jwt.Core; |
8 | 9 | using NetDevPack.Security.Jwt.Core.Interfaces; |
9 | 10 |
|
10 | 11 | namespace Microsoft.Extensions.DependencyInjection; |
11 | 12 |
|
12 | 13 | public static class JwtBuilderExtensions |
13 | 14 | { |
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> |
15 | 17 | { |
16 | 18 | services.AddDataProtection(); |
17 | 19 | services.AddScoped<IJwtBuilder, JwtBuilderInject<TIdentityUser, TKey>>(); |
18 | 20 | return services.AddHttpContextAccessor().AddJwksManager(); |
19 | 21 | } |
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 |
21 | 24 | { |
22 | 25 | services.AddDataProtection(); |
23 | 26 | services.AddScoped<IJwtBuilder, JwtBuilderInject<TIdentityUser, string>>(); |
24 | 27 | return services.AddHttpContextAccessor().AddJwksManager(); |
25 | 28 | } |
26 | | - public static IJwksBuilder AddNetDevPackIdentity(this IServiceCollection services) |
| 29 | + public static IJwksBuilder AddNetDevPackIdentity(this IServiceCollection services, Action<JwtOptions> options = null) |
27 | 30 | { |
28 | 31 | services.AddDataProtection(); |
29 | 32 | services.AddScoped<IJwtBuilder, JwtBuilderInject<IdentityUser, string>>(); |
30 | | - return services.AddHttpContextAccessor().AddJwksManager(); |
| 33 | + return services.AddHttpContextAccessor().AddJwksManager(options); |
31 | 34 | } |
32 | 35 |
|
33 | 36 | public static IdentityBuilder AddIdentityConfiguration(this IServiceCollection services) |
|
0 commit comments