Ejemplo n.º 1
0
 public ActionResult SignIn()
 {
     this.ControllerContext.HttpContext.User = CustomAuth.GetFakeUser();
     if (User.Identity.IsAuthenticated)
     {
         return(RedirectToAction("Index", "Dashboard"));
     }
     else
     {
         return(RedirectToAction("Index", "Dashboard"));
         //return View();
     }
 }
Ejemplo n.º 2
0
        public ActionResult Login(User user)
        {
            var currentUser = DbFactory.UserCRUD.CheckLogin(user);

            if (currentUser != null)
            {
                CustomAuth auth = new CustomAuth(currentUser);
                if (HttpContext.User != null)
                {
                    HttpContext.User = auth;
                    FormsAuthentication.SetAuthCookie(currentUser._id, false);
                    return(Json(true, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                ModelState.AddModelError("", "Invalid User Name or Password");
            }

            return(View());
        }
Ejemplo n.º 3
0
        // Require HTTPS for all requests processed by ASP.NET
        protected void Application_BeginRequest(Object sender, EventArgs e)
        {
            Thread.CurrentThread.CurrentCulture          = Thread.CurrentThread.CurrentUICulture = GetSelectedCulture();
            this.Request.RequestContext.HttpContext.User = CustomAuth.GetFakeUser();
            if (Context.Request.IsSecureConnection)
            {
                // HSTS blocks access to sites with invalid certs
                bool usingValidTlsCert = false;

                // tell the browser that this site is ALWAYS https (but only if the cert is valid!)
                if (usingValidTlsCert)
                {
                    // note: to clear this from a browser, set the header with "max-age=0"
                    Response.AddHeader("Strict-Transport-Security", "max-age=3600");
                }
            }
            else
            {
                // (if we are serving HTTP) redirect users to HTTPS
                Response.RedirectPermanent(Context.Request.Url.ToString().Replace("http://", "https://"), false);
                CompleteRequest();
            }
        }
Ejemplo n.º 4
0
 private void InitializeComponent()
 {
     this.module1                        = new DevExpress.ExpressApp.SystemModule.SystemModule();
     this.module2                        = new DevExpress.ExpressApp.Web.SystemModule.SystemAspNetModule();
     this.module3                        = new MyCompanyInvoices.Module.MyCompanyInvoicesModule();
     this.module4                        = new MyCompanyInvoices.Module.Web.MyCompanyInvoicesAspNetModule();
     this.securityModule1                = new DevExpress.ExpressApp.Security.SecurityModule();
     this.securityStrategyComplex1       = new DevExpress.ExpressApp.Security.SecurityStrategyComplex();
     this.objectsModule                  = new DevExpress.ExpressApp.Objects.BusinessClassLibraryCustomizationModule();
     this.cloneObjectModule              = new DevExpress.ExpressApp.CloneObject.CloneObjectModule();
     this.fileAttachmentsAspNetModule    = new DevExpress.ExpressApp.FileAttachments.Web.FileAttachmentsAspNetModule();
     this.htmlPropertyEditorAspNetModule = new DevExpress.ExpressApp.HtmlPropertyEditor.Web.HtmlPropertyEditorAspNetModule();
     this.reportsModuleV2                = new DevExpress.ExpressApp.ReportsV2.ReportsModuleV2();
     this.reportsAspNetModuleV2          = new DevExpress.ExpressApp.ReportsV2.Web.ReportsAspNetModuleV2();
     this.validationModule               = new DevExpress.ExpressApp.Validation.ValidationModule();
     this.validationAspNetModule         = new DevExpress.ExpressApp.Validation.Web.ValidationAspNetModule();
     this.conditionalAppearanceModule1   = new DevExpress.ExpressApp.ConditionalAppearance.ConditionalAppearanceModule();
     this.customAuth1                    = new MyCompanyInvoices.Module.BusinessObjects.CustomAuth();
     ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
     //
     // securityStrategyComplex1
     //
     this.securityStrategyComplex1.AllowAnonymousAccess = false;
     this.securityStrategyComplex1.Authentication       = this.customAuth1;
     this.securityStrategyComplex1.RoleType             = typeof(DevExpress.Persistent.BaseImpl.PermissionPolicy.PermissionPolicyRole);
     this.securityStrategyComplex1.SupportNavigationPermissionsForTypes = false;
     this.securityStrategyComplex1.UserType = typeof(MyCompanyInvoices.Module.BusinessObjects.CompanySeller);
     //
     // cloneObjectModule
     //
     this.cloneObjectModule.ClonerType = null;
     //
     // reportsModuleV2
     //
     this.reportsModuleV2.EnableInplaceReports = true;
     this.reportsModuleV2.ReportDataType       = typeof(DevExpress.Persistent.BaseImpl.ReportDataV2);
     this.reportsModuleV2.ReportStoreMode      = DevExpress.ExpressApp.ReportsV2.ReportStoreModes.XML;
     //
     // reportsAspNetModuleV2
     //
     this.reportsAspNetModuleV2.ReportViewerType = DevExpress.ExpressApp.ReportsV2.Web.ReportViewerTypes.HTML5;
     //
     // validationModule
     //
     this.validationModule.AllowValidationDetailsAccess     = true;
     this.validationModule.IgnoreWarningAndInformationRules = false;
     //
     // MyCompanyInvoicesAspNetApplication
     //
     this.ApplicationName        = "MyCompanyInvoices";
     this.CheckCompatibilityType = DevExpress.ExpressApp.CheckCompatibilityType.DatabaseSchema;
     this.Modules.Add(this.module1);
     this.Modules.Add(this.module2);
     this.Modules.Add(this.objectsModule);
     this.Modules.Add(this.cloneObjectModule);
     this.Modules.Add(this.reportsModuleV2);
     this.Modules.Add(this.validationModule);
     this.Modules.Add(this.conditionalAppearanceModule1);
     this.Modules.Add(this.securityModule1);
     this.Modules.Add(this.module3);
     this.Modules.Add(this.fileAttachmentsAspNetModule);
     this.Modules.Add(this.htmlPropertyEditorAspNetModule);
     this.Modules.Add(this.reportsAspNetModuleV2);
     this.Modules.Add(this.validationAspNetModule);
     this.Modules.Add(this.module4);
     this.Security = this.securityStrategyComplex1;
     this.DatabaseVersionMismatch += new System.EventHandler <DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs>(this.MyCompanyInvoicesAspNetApplication_DatabaseVersionMismatch);
     ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
 }
Ejemplo n.º 5
0
 public WebApiRequirePermissionAttribute(params Permission[] values)
 {
     this.Permissions = CustomAuth.GetFullPermission();
     //if (values != null)
     //    this.Permissions = values.ToList();
 }