Esempio n. 1
0
        // public readonly LoginAuthorizationRoles Roles;

        #region constructors and init
        public LoginModule(EntityArea area, LoginModuleSettings settings, string name = null) : base(area, name ?? "LoginModule", "Login module", version: CurrentVersion)
        {
            _settings = settings;
            App.RegisterConfig(_settings);
            //Register entities
            RegisterEntities(typeof(ILogin), typeof(ISecretQuestion), typeof(ISecretQuestionAnswer),
                             typeof(ITrustedDevice), typeof(ILoginExtraFactor), typeof(ILoginProcess));
            //Register services
            App.RegisterService <ILoginService>(this);
            App.RegisterService <ILoginProcessService>(this);
            App.RegisterService <ILoginManagementService>(this);
            App.RegisterService <ILoginAdministrationService>(this);
            RegisterSize("EventType", 50);
        }
Esempio n. 2
0
        // We need to have a parameterless constructor (it might be internal) if we want to use vdbtool to generate DDL scripts
        internal BooksEntityApp()
            : base("BookStore", CurrentVersion)
        {
            //Areas
              var booksArea = this.AddArea("books");
              var infoArea = this.AddArea("info");
              var loginArea = this.AddArea("login");

              //main module
              MainModule = new BooksModule(booksArea);
              //Standard modules
              var dbInfoModule = new DbInfoModule(infoArea);
              var cryptModule = new EncryptedDataModule(loginArea); //EncryptedData is used by login module
              var templateModule = new TemplateModule(booksArea);
              // LoginModule
              var loginStt = new LoginModuleSettings(passwordExpirationPeriod: TimeSpan.FromDays(180));
              loginStt.RequiredPasswordStrength = PasswordStrength.Medium;
              loginStt.DefaultEmailFrom = "*****@*****.**";

              var loginModule = new LoginModule(loginArea, loginStt);
              //var oauthModule = new OAuthClientModule(loginArea);
              //data history - we track history for book review, it is marked with WithHistory attribute
              var histModule = new DataHistoryModule(booksArea);

              //Notification service
              var notificationService = new Vita.Modules.Notifications.NotificationService(this);
              // Authorization object - uses LoginModule's authorization objects
              Authorization = new BooksAuthorization(this, loginModule);
              //api config - register controllers defined in Vita.Modules assembly; books controllers are registered by BooksModule
              base.ApiConfiguration.RegisterControllerTypes(
            typeof(LoginController), typeof(PasswordResetController), typeof(LoginSelfServiceController), typeof(LoginAdministrationController),
            typeof(ClientErrorController), typeof(LoggingDataController), typeof(EventsPostController),
            typeof(DiagnosticsController)
            );

              //logging app - linked to main app
              this.LoggingApp = new LoggingEntityApp("log");
              LoggingApp.LinkTo(this);

              //short expir period, just for testing
              var sessionStt = LoggingApp.GetConfig<UserSessionSettings>();
              sessionStt.SessionTimeout = TimeSpan.FromMinutes(5);
        }
Esempio n. 3
0
 public LoginModule(EntityArea area, LoginModuleSettings settings, string name = null) : base(area, name ?? "LoginModule", "Login module", version: CurrentVersion)
 {
     _settings = settings;
     App.RegisterConfig(_settings);
     //Register entities
     RegisterEntities(typeof(ILogin), typeof(ISecretQuestion), typeof(ISecretQuestionAnswer), typeof(ITrustedDevice),
                      typeof(ILoginExtraFactor), typeof(IPasswordHistory), typeof(ILoginProcess));
     //Register services
     App.RegisterService <ILoginService>(this);
     App.RegisterService <ILoginProcessService>(this);
     App.RegisterService <ILoginManagementService>(this);
     App.RegisterService <ILoginAdministrationService>(this);
     RegisterSize("EventType", 50);
     Roles = new LoginAuthorizationRoles();
     // Create recaptcha service if settings are there
     if (_settings.Recaptcha != null)
     {
         var recaptcha = new RecaptchaService(_settings.Recaptcha);
         App.RegisterService <IRecaptchaService>(recaptcha);
     }
 }
Esempio n. 4
0
 public LoginModule(EntityArea area, LoginModuleSettings settings, string name = null)
     : base(area, name ?? "LoginModule", "Login module", version: CurrentVersion)
 {
     _settings = settings;
       App.RegisterConfig(_settings);
       //Register entities
       RegisterEntities(typeof(ILogin), typeof(ISecretQuestion), typeof(ISecretQuestionAnswer),  typeof(ITrustedDevice),
       typeof(ILoginExtraFactor), typeof(IPasswordHistory), typeof(ILoginProcess));
       //Register services
       App.RegisterService<ILoginService>(this);
       App.RegisterService<ILoginProcessService>(this);
       App.RegisterService<ILoginManagementService>(this);
       App.RegisterService<ILoginAdministrationService>(this);
       Requires<EncryptedDataModule>();
       Requires<TextTemplates.TemplateModule>();
       RegisterSize("EventType", 50);
       // Create recaptcha service if settings are there
       if (_settings.Recaptcha != null) {
     var recaptcha = new RecaptchaService(_settings.Recaptcha);
     App.RegisterService<IRecaptchaService>(recaptcha);
       }
 }