public EditModel(ApplicationDbContext context, ImageUploader uploader, OgmaConfig config, IMapper mapper) { _context = context; _uploader = uploader; _config = config; _mapper = mapper; }
public FolderModel(ClubRepository clubRepo, FoldersRepository foldersRepo, OgmaConfig config, StoriesRepository storiesRepo) { _clubRepo = clubRepo; _foldersRepo = foldersRepo; _config = config; _storiesRepo = storiesRepo; }
public DeleteModel(ApplicationDbContext context, IB2Client b2Client, IConfiguration config, OgmaConfig ogmaConfig) { _context = context; _b2Client = b2Client; _config = config; _ogmaConfig = ogmaConfig; }
public CreateModel(ApplicationDbContext context, ImageUploader uploader, OgmaConfig config, NotificationsRepository notificationsRepo) { _context = context; _uploader = uploader; _config = config; _notificationsRepo = notificationsRepo; }
public InviteCodesController(ApplicationDbContext context, OgmaUserManager userManager, OgmaConfig config, IMapper mapper) { _context = context; _userManager = userManager; _config = config; _mapper = mapper; }
public CommentsController(ApplicationDbContext context, OgmaConfig ogmaConfig, CommentsRepository commentsRepo, IMapper mapper) { _context = context; _ogmaConfig = ogmaConfig; _commentsRepo = commentsRepo; _mapper = mapper; }
public FolderModel(ApplicationDbContext context, IMapper mapper, OgmaConfig config, ClubRepository clubRepo) { _context = context; _mapper = mapper; _config = config; _clubRepo = clubRepo; }
public CommentsController(ApplicationDbContext context, OgmaConfig ogmaConfig, CommentsRepository commentsRepo, NotificationsRepository notificationsRepo, CommentRedirector redirector, IMapper mapper) { _context = context; _ogmaConfig = ogmaConfig; _commentsRepo = commentsRepo; _notificationsRepo = notificationsRepo; _redirector = redirector; _mapper = mapper; }
public IndexModel( OgmaUserManager userManager, SignInManager <OgmaUser> signInManager, IB2Client b2Client, ImageUploader uploader, OgmaConfig ogmaConfig) { _userManager = userManager; _signInManager = signInManager; _b2Client = b2Client; _uploader = uploader; _ogmaConfig = ogmaConfig; }
public Settings(OgmaConfig config) { _config = config; }
public ConfigTestController(OgmaConfig ogmaConfig) { _ogmaConfig = ogmaConfig; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationDbContext>(options => options.UseNpgsql( Environment.GetEnvironmentVariable("DATABASE_URL") ?? Configuration.GetConnectionString("DbConnection") )); services.AddDatabaseDeveloperPageExceptionFilter(); // Repositories services.AddScoped <UserRepository>(); services.AddScoped <ClubRepository>(); services.AddScoped <ThreadRepository>(); services.AddScoped <StoriesRepository>(); services.AddScoped <TagsRepository>(); services.AddScoped <ChaptersRepository>(); services.AddScoped <BlogpostsRepository>(); services.AddScoped <CommentsRepository>(); services.AddScoped <FoldersRepository>(); services.AddScoped <NotificationsRepository>(); // Custom persistent config services.AddSingleton(OgmaConfig.Init("config.json")); // Routing services.AddRouting(options => options.LowercaseUrls = true); // HttpContextAccessor services.AddHttpContextAccessor(); // ActionContextAccessor services.AddSingleton <IActionContextAccessor, ActionContextAccessor>(); // UrlHelperFactory services.AddSingleton <IUrlHelperFactory, UrlHelperFactory>(); // Identity services.AddIdentity <OgmaUser, OgmaRole>(config => { config.SignIn.RequireConfirmedEmail = true; config.User.AllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ "; config.User.RequireUniqueEmail = true; }) .AddEntityFrameworkStores <ApplicationDbContext>() .AddUserManager <OgmaUserManager>() .AddDefaultTokenProviders() .AddUserStore <UserStore <OgmaUser, OgmaRole, ApplicationDbContext, long, IdentityUserClaim <long>, UserRole, IdentityUserLogin <long>, IdentityUserToken <long>, IdentityRoleClaim <long> > >() .AddRoleStore <RoleStore <OgmaRole, ApplicationDbContext, long, UserRole, IdentityRoleClaim <long> > >(); // Logged in user service services.AddTransient <IUserService, UserService>(); // Claims services.AddScoped <IUserClaimsPrincipalFactory <OgmaUser>, OgmaClaimsPrincipalFactory>(); services.AddScoped(s => s.GetService <IHttpContextAccessor>()?.HttpContext?.User); // Argon2 hasher services.UpgradePasswordSecurity().UseArgon2 <OgmaUser>(); // Email services.AddTransient <IEmailSender, EmailSender>(); services.Configure <AuthMessageSenderOptions>(Configuration); // Backblaze var b2Options = Configuration.GetSection("B2").Get <B2Options>(); var b2Client = new B2Client(B2Client.Authorize(b2Options)); services.AddSingleton <IB2Client>(b2Client); // File uploader services.AddSingleton <ImageUploader>(); // ReCaptcha services.Configure <RecaptchaSettings>(Configuration.GetSection("RecaptchaSettings")); services.AddTransient <IRecaptchaService, RecaptchaService>(); // Seeding services.AddAsyncInitializer <DbSeedInitializer>(); // Auth services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme); // Auth services.AddAuthorization(options => { options.AddPolicy("RequireAdminRole", policy => policy.RequireRole("Admin")); }); // Cookies services.ConfigureApplicationCookie(options => { options.LoginPath = new PathString("/login"); options.LogoutPath = new PathString("/logout"); options.AccessDeniedPath = new PathString("/login"); options.Cookie.SameSite = SameSiteMode.Lax; options.Cookie.SecurePolicy = CookieSecurePolicy.Always; options.Events.OnRedirectToLogin = HandleApiRequest(StatusCodes.Status401Unauthorized, options.Events.OnRedirectToLogin); options.Events.OnRedirectToAccessDenied = HandleApiRequest(StatusCodes.Status403Forbidden, options.Events.OnRedirectToLogin); }); // Compression services.AddResponseCompression(); // Cache services.AddMemoryCache(); // Automapper services.AddAutoMapper(typeof(AutoMapperProfile)); // Runtime compilation services.AddControllersWithViews().AddRazorRuntimeCompilation(); // Razor services.AddRazorPages().AddRazorPagesOptions(options => { options.Conventions.AuthorizeAreaFolder("Admin", "/", "RequireAdminRole"); options.Conventions .AddPageRoute("/Club/Index", "/club/{slug}-{id}") .AddAreaPageRoute("Identity", "/Account/Manage/ChangePassword", "/.well-known/change-password"); }); // MVC services .AddMvc(options => { options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute()); }) .AddJsonOptions(options => { options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); options.JsonSerializerOptions.IgnoreNullValues = true; }); // SignalR services.AddSignalR(); }
public void OnGet() { Config = _config; }
public IndexModel(ApplicationDbContext context, ClubRepository clubRepo, OgmaConfig config) { _context = context; _clubRepo = clubRepo; _config = config; }
public CdnImgTagHelper(OgmaConfig ogmaConfig) { _ogmaConfig = ogmaConfig; }
public IndexModel(ApplicationDbContext context, StoriesRepository storiesRepo, OgmaConfig config) { _context = context; _storiesRepo = storiesRepo; _config = config; }
public EmailSender(IOptions <AuthMessageSenderOptions> optionsAccessor, OgmaConfig config) { _config = config; _options = optionsAccessor.Value; }
public IndexModel(ClubRepository clubRepo, OgmaConfig config) { _clubRepo = clubRepo; _config = config; }
public CreateModel(ApplicationDbContext context, ImageUploader uploader, OgmaConfig config) { _context = context; _uploader = uploader; _config = config; }
public DeleteModel(ApplicationDbContext context, IB2Client b2Client, OgmaConfig config) { _context = context; _b2Client = b2Client; _config = config; }
public IndexModel(ApplicationDbContext context, IMapper mapper, OgmaConfig config) { _context = context; _mapper = mapper; _config = config; }
public CdnPictureTagHelper(OgmaConfig config) { _config = config; }