Exemplo n.º 1
0
        public static MajidIdentityBuilder AddMajidLogInManager <TLogInManager>(this MajidIdentityBuilder builder)
            where TLogInManager : class
        {
            var type             = typeof(TLogInManager);
            var majidManagerType = typeof(MajidLogInManager <, ,>).MakeGenericType(builder.TenantType, builder.RoleType, builder.UserType);

            builder.Services.AddScoped(type, provider => provider.GetService(majidManagerType));
            builder.Services.AddScoped(majidManagerType, type);
            return(builder);
        }
Exemplo n.º 2
0
        public static MajidIdentityBuilder AddMajidSignInManager <TSignInManager>(this MajidIdentityBuilder builder)
            where TSignInManager : class
        {
            var majidManagerType = typeof(MajidSignInManager <, ,>).MakeGenericType(builder.TenantType, builder.RoleType, builder.UserType);
            var managerType      = typeof(SignInManager <>).MakeGenericType(builder.UserType);

            builder.Services.AddScoped(majidManagerType, services => services.GetRequiredService(managerType));
            builder.AddSignInManager <TSignInManager>();
            return(builder);
        }
Exemplo n.º 3
0
        public static MajidIdentityBuilder AddMajidEditionManager <TEditionManager>(this MajidIdentityBuilder builder)
            where TEditionManager : class
        {
            var type             = typeof(TEditionManager);
            var majidManagerType = typeof(MajidEditionManager);

            builder.Services.AddScoped(type, provider => provider.GetRequiredService(majidManagerType));
            builder.Services.AddScoped(majidManagerType, type);
            return(builder);
        }
Exemplo n.º 4
0
        public static MajidIdentityBuilder AddFeatureValueStore <TFeatureValueStore>(this MajidIdentityBuilder builder)
            where TFeatureValueStore : class
        {
            var type      = typeof(TFeatureValueStore);
            var storeType = typeof(MajidFeatureValueStore <,>).MakeGenericType(builder.TenantType, builder.UserType);

            builder.Services.AddScoped(type);
            builder.Services.AddScoped(storeType, provider => provider.GetService(type));
            builder.Services.AddScoped(typeof(IFeatureValueStore), provider => provider.GetService(type));
            return(builder);
        }
Exemplo n.º 5
0
        public static MajidIdentityBuilder AddPermissionChecker <TPermissionChecker>(this MajidIdentityBuilder builder)
            where TPermissionChecker : class
        {
            var type        = typeof(TPermissionChecker);
            var checkerType = typeof(PermissionChecker <,>).MakeGenericType(builder.RoleType, builder.UserType);

            builder.Services.AddScoped(type);
            builder.Services.AddScoped(checkerType, provider => provider.GetService(type));
            builder.Services.AddScoped(typeof(IPermissionChecker), provider => provider.GetService(type));
            return(builder);
        }
Exemplo n.º 6
0
        public static MajidIdentityBuilder AddMajidRoleStore <TRoleStore>(this MajidIdentityBuilder builder)
            where TRoleStore : class
        {
            var type           = typeof(TRoleStore);
            var majidStoreType = typeof(MajidRoleStore <,>).MakeGenericType(builder.RoleType, builder.UserType);
            var storeType      = typeof(IRoleStore <>).MakeGenericType(builder.RoleType);

            builder.Services.AddScoped(type);
            builder.Services.AddScoped(majidStoreType, services => services.GetRequiredService(type));
            builder.Services.AddScoped(storeType, services => services.GetRequiredService(type));
            return(builder);
        }
Exemplo n.º 7
0
        public static MajidIdentityBuilder AddMajidSecurityStampValidator <TSecurityStampValidator>(this MajidIdentityBuilder builder)
            where TSecurityStampValidator : class, ISecurityStampValidator
        {
            var type = typeof(TSecurityStampValidator);

            builder.Services.AddScoped(typeof(SecurityStampValidator <>).MakeGenericType(builder.UserType), services => services.GetRequiredService(type));
            builder.Services.AddScoped(typeof(MajidSecurityStampValidator <, ,>).MakeGenericType(builder.TenantType, builder.RoleType, builder.UserType), services => services.GetRequiredService(type));
            builder.Services.AddScoped(typeof(ISecurityStampValidator), services => services.GetRequiredService(type));
            builder.Services.AddScoped(type);
            return(builder);
        }
Exemplo n.º 8
0
        public static MajidIdentityBuilder AddMajidUserClaimsPrincipalFactory <TUserClaimsPrincipalFactory>(this MajidIdentityBuilder builder)
            where TUserClaimsPrincipalFactory : class
        {
            var type = typeof(TUserClaimsPrincipalFactory);

            builder.Services.AddScoped(typeof(UserClaimsPrincipalFactory <,>).MakeGenericType(builder.UserType, builder.RoleType), services => services.GetRequiredService(type));
            builder.Services.AddScoped(typeof(MajidUserClaimsPrincipalFactory <,>).MakeGenericType(builder.UserType, builder.RoleType), services => services.GetRequiredService(type));
            builder.Services.AddScoped(typeof(IUserClaimsPrincipalFactory <>).MakeGenericType(builder.UserType), services => services.GetRequiredService(type));
            builder.Services.AddScoped(type);
            return(builder);
        }