Exemplo n.º 1
0
        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)));
        }
Exemplo n.º 2
0
        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)));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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"));;
        }
Exemplo n.º 6
0
        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"));
        }
Exemplo n.º 7
0
        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"));
        }
Exemplo n.º 8
0
 public static IConveyBuilder AddJwt(this IConveyBuilder builder, JwtOptions options,
                                     RedisOptions redisOptions = null)
 => builder.AddJwt(options, b => b.AddRedis(redisOptions ?? new RedisOptions()));
Exemplo n.º 9
0
        public static IConveyBuilder AddJwt(this IConveyBuilder builder, string sectionName = SectionName)
        {
            var options = builder.GetOptions <JwtOptions>(sectionName);

            return(builder.AddJwt(options));
        }