public static IConveyBuilder AddJwt(this IConveyBuilder builder, Func <IJwtOptionsBuilder, IJwtOptionsBuilder> buildOptions, Func <IRedisOptionsBuilder, IRedisOptionsBuilder> buildRedisOptions = null) { var options = buildOptions(new JwtOptionsBuilder()).Build(); return(buildRedisOptions is null ? builder.AddJwt(options) : builder.AddJwt(options, b => b.AddRedis(buildRedisOptions))); }
public static IConveyBuilder AddJwt(this IConveyBuilder builder, string sectionName = SectionName, string redisSectionName = "redis") { var options = builder.GetOptions <JwtOptions>(sectionName); var redisOptions = builder.GetOptions <RedisOptions>(redisSectionName); return(builder.AddJwt(options, b => b.AddRedis(redisOptions))); }
public static IConveyBuilder AddJwt(this IConveyBuilder builder, string sectionName = SectionName) { if (string.IsNullOrWhiteSpace(sectionName)) { sectionName = SectionName; } var options = builder.GetOptions <JwtOptions>(sectionName); return(builder.AddJwt(options)); }
public static IConveyBuilder AddJwt(this IConveyBuilder builder, string sectionName = SectionName, Action <JwtBearerOptions> optionsFactory = null) { if (string.IsNullOrWhiteSpace(sectionName)) { sectionName = SectionName; } var options = builder.GetOptions <JwtOptions>(sectionName); return(builder.AddJwt(options, optionsFactory)); }
public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder) { builder.AddJwt(); return(builder .AddMongo() .AddMongoRepository <UserDocument, Guid>("users") .AddMongoRepository <AuthorDocument, Guid>("authors") .AddMongoRepository <CourseDocument, Guid>("courses") .AddMongoRepository <StudentDocument, Guid>("students") .AddMongoRepository <CategoryDocument, Guid>("categories") .AddMongoRepository <RefreshTokenDocument, Guid>("refreshTokens"));; }
public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder) { builder.Services.AddSingleton <IJwtProvider, JwtProvider>(); builder.Services.AddSingleton <IPasswordService, PasswordService>(); builder.Services.AddSingleton <IPasswordHasher <IPasswordService>, PasswordHasher <IPasswordService> >(); builder.Services.AddTransient <IIdentityService, IdentityService>(); builder.Services.AddTransient <IRefreshTokenService, RefreshTokenService>(); builder.Services.AddTransient <IUserRepository, UserMongoRepository>(); builder.Services.AddTransient <IRefreshTokenRepository, RefreshTokenRepository>(); builder.Services.AddTransient <IMessageBroker, MessageBroker>(); builder.Services.AddSingleton <IRng, Rng>(); return(builder .AddJwt() .AddMongo() .AddMongoRepository <UserDocument, Guid>("users") .AddMongoRepository <RefreshTokenDocument, Guid>("refreshTokens")); }
public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder) { builder.Services.AddSingleton <IJwtProvider, JwtProvider>(); builder.Services.AddSingleton <IIdentityService, IdentityService>(); builder.Services.AddSingleton <IPasswordService, PasswordService>(); builder.Services.AddTransient <IMessageBroker, MessageBroker>(); builder.Services.AddTransient <IUserRepository, UserRepository>(); builder.Services.AddSingleton <IPasswordHasher <IPasswordService>, PasswordHasher <IPasswordService> >(); return(builder.AddJwt() .AddCommandHandlers() .AddEventHandlers() .AddQueryHandlers() .AddHttpClient() .AddConsul() .AddFabio() .AddRabbitMq() .AddMongo() .AddMongoRepository <UserDocument, Guid>("Users")); }
public static IConveyBuilder AddJwt(this IConveyBuilder builder, JwtOptions options, RedisOptions redisOptions = null) => builder.AddJwt(options, b => b.AddRedis(redisOptions ?? new RedisOptions()));
public static IConveyBuilder AddJwt(this IConveyBuilder builder, string sectionName = SectionName) { var options = builder.GetOptions <JwtOptions>(sectionName); return(builder.AddJwt(options)); }