public virtual bool Uninstall(INccSettingsService settingsService, Func <NccDbQueryText, string> executeQuery) { return(true); }
public StoreSettingsController(INccSettingsService nccSettingsService, ILoggerFactory factory) { _nccSettingsService = nccSettingsService; _logger = factory.CreateLogger <StoreSettingsController>(); storeSettings = _nccSettingsService.GetByKey <StoreSettings>() ?? new StoreSettings(); }
public virtual bool Update(INccSettingsService settingsService, Func <NccDbQueryText, string> executeQuery, Func <Type, bool, int> createUpdateTable) { return(true); }
public virtual bool RemoveTables(INccSettingsService settingsService, Func <NccDbQueryText, string> executeQuery, Func <Type, int> deleteTable) { return(true); }
public virtual void Init(IServiceCollection services, INccSettingsService nccSettingsService) { //Initilize the module here }
public static IServiceCollection AddCustomizedIdentity(this IServiceCollection services, INccSettingsService nccSettingsService) { services.AddIdentity <NccUser, NccRole>( configure => { if (GlobalContext.HostingEnvironment.IsDevelopment()) { configure.Password.RequiredLength = 1; configure.Password.RequireDigit = false; configure.Password.RequireLowercase = false; configure.Password.RequireNonAlphanumeric = false; configure.Password.RequireUppercase = false; } else { configure.Password.RequiredLength = 6; configure.Password.RequireDigit = true; configure.Password.RequireLowercase = false; configure.Password.RequireNonAlphanumeric = false; configure.Password.RequireUppercase = false; } configure.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(365 * 200); configure.Lockout.MaxFailedAccessAttempts = 5; configure.SignIn.RequireConfirmedEmail = false; configure.SignIn.RequireConfirmedPhoneNumber = false; } ) .AddEntityFrameworkStores <NccDbContext>() .AddRoleStore <NccRoleStore>() .AddUserStore <NccUserStore>() .AddDefaultTokenProviders() .AddSignInManager <SignInManager <NccUser> >(); var authBuilder = services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme); authBuilder = authBuilder.AddCookie(options => { options.Cookie.Name = ".DamaCoreCMS.Cookie"; options.Cookie.Expiration = new TimeSpan(0, 20, 0); options.LoginPath = "/Account/Login"; options.LogoutPath = "/Account/Logoff"; options.AccessDeniedPath = "/Account/AccessDenied"; }); if (nccSettingsService != null) { var settings = nccSettingsService.GetByKey <OpenIdSettings>(); if (settings != null && string.IsNullOrEmpty(settings.GoogleClientId) == false && string.IsNullOrEmpty(settings.GoogleClientSecret) == false) { authBuilder = authBuilder.AddGoogle(GoogleDefaults.AuthenticationScheme, x => { x.ClientId = settings.GoogleClientId; x.ClientSecret = settings.GoogleClientSecret; x.CallbackPath = "/Account/ExternalLoginCallback"; x.Events = new OAuthEvents { OnRemoteFailure = ctx => HandleRemoteLoginFailure(ctx) }; }); } if (settings != null && string.IsNullOrEmpty(settings.MicrosoftAppId) == false && string.IsNullOrEmpty(settings.MicrosoftAppPassword) == false) { authBuilder = authBuilder.AddMicrosoftAccount(x => { x.ClientId = settings.MicrosoftAppId; x.ClientSecret = settings.MicrosoftAppPassword; x.CallbackPath = "/Account/ExternalLoginCallback"; }); } if (settings != null && string.IsNullOrEmpty(settings.TwitterConsumerKey) == false && string.IsNullOrEmpty(settings.TwitterCustomerSecret) == false) { authBuilder = authBuilder.AddTwitter(TwitterDefaults.AuthenticationScheme, x => { x.CallbackPath = "/Account/ExternalLoginCallback"; x.ConsumerKey = settings.TwitterConsumerKey; x.ConsumerSecret = settings.TwitterCustomerSecret; }); } if (settings != null && string.IsNullOrEmpty(settings.FacebookAppId) == false && string.IsNullOrEmpty(settings.FacebookAppSecret) == false) { authBuilder = authBuilder.AddFacebook(FacebookDefaults.AuthenticationScheme, x => { x.AppId = settings.FacebookAppId; x.AppSecret = settings.FacebookAppSecret; x.CallbackPath = "/Account/ExternalLoginCallback"; x.Scope.Add("email"); x.Fields.Add("name"); x.Fields.Add("email"); x.SaveTokens = true; x.Events = new OAuthEvents { OnRemoteFailure = ctx => HandleRemoteLoginFailure(ctx) }; }); } } services.ConfigureApplicationCookie(options => { options.LoginPath = "/Account/Login"; }); /* * services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) * .AddCookie(o => o.LoginPath = new PathString("/Account/login")) * * .AddFacebook(x => * { * x.AppId = ""; * x.AppSecret = ""; * * x.Events = new OAuthEvents * { * OnRemoteFailure = ctx => HandleRemoteLoginFailure(ctx) * }; * }) * .AddGoogle(x => * { * x.ClientId = ""; * x.ClientSecret = ""; * x.Events = new OAuthEvents * { * OnRemoteFailure = ctx => HandleRemoteLoginFailure(ctx) * }; * }); */ return(services); }
public bool Uninstall(INccSettingsService settingsService, Func <NccDbQueryText, string> executeQuery, Func <Type, int> deleteTable) { return(true); }
public void Init(IServiceCollection services, INccSettingsService nccSettingsService) { }
public NccControllerFilter(ILoggerFactory loggerFactory, IMemoryCache memoryCache, INccUserService nccUserService, INccSettingsService nccSettingsService) { _loggerFactory = loggerFactory; _memoryCache = memoryCache; _nccUserService = nccUserService; _nccSettingsService = nccSettingsService; }