示例#1
0
 /*Funcion: construye los datos de un insert
   Param: Action, NewValues, audit
   Return: status
   */
 public CUDView formInsert(String Action, String NewValues, AuditDataFromWeb audit)
 {
     InsertActionServerAuditTrailView x = new InsertActionServerAuditTrailView();
     x.Reason=audit.Reason;
     x.StationIP=audit.StationIP;
     x.UserName=audit.UserName;
     x.Action = Action;
     x.NewValues = NewValues;
     return insertAuditTrail(x);
 }
示例#2
0
        /*
        Metodo que verifica que el usuario este autorizado en el active para ingresar al sistema
        */
        protected void buttonLogin_Click(object sender, EventArgs e)
        {
            String adPath = "LDAP://bsci.bossci.com"; //Fully-qualified Domain Name
            LdapAuthentication adAuth = new LdapAuthentication(adPath);
            try
            {
                if (true == adAuth.IsAuthenticated("BSCI", Login.Text, Password.Text))
                {
                    String groups = adAuth.GetGroups();

                    //Create the ticket, and add the groups.
                    bool isCookiePersistent = false;
                    FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, Login.Text,
                    DateTime.Now, DateTime.Now.AddMinutes(60), isCookiePersistent, groups);

                    //Encrypt the ticket.
                    String encryptedTicket = FormsAuthentication.Encrypt(authTicket);

                    //Create a cookie, and then add the encrypted ticket to the cookie as data.
                    HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);

                    if (true == isCookiePersistent)
                        authCookie.Expires = authTicket.Expiration;

                    //Add the cookie to the outgoing cookies collection.
                    Response.Cookies.Add(authCookie);

                    //Save data in server audit trail
                    InsertActionServerAuditTrailView view = new InsertActionServerAuditTrailView();
                    AuditService auditService = new AuditService();
                    String reason = "User Log In";
                    String user = Context.User.Identity.Name;
                    view.Reason = reason;
                    view.StationIP = General.getIp(this.Page);
                    view.UserName = Login.Text;
                    view.Action = "Login user";
                    view.NewValues = "N/A";
                    auditService.insertAuditTrail(view);

                    //Redirect now.
                    Response.Redirect("~/Default.aspx",false);
                }
                else
                {
                    errorLabel.Text = "Authentication did not succeed. Check user name and password.";
                }
            }
            catch (Exception ex)
            {
                errorLabel.Text = "Error authenticating. " + ex.Message;
            }
        }
示例#3
0
 /*
   Funcion: Inserta ActionServerAuditTrail
   Param: StationIP,Action,Reason,NewValues,UserName
   Return: Status
   */
 public String insertAudit(InsertActionServerAuditTrailView audit)
 {
     return context.InsertUpdateDeleteMSQL("EXEC insertServerAuditTrail @StationIP='" + audit.StationIP +
      "',@Action='" + audit.Action + "',@Reason='" + audit.Reason + "',@OldValues='N/A',@NewValues='" + audit.NewValues
      + "',@UserName='******'");
 }
示例#4
0
 /*Funcion: inserta un nuevo Audit Trail
   Param: InsertActionServerAuditTrailView
   Return: status
   */
 public CUDView insertAuditTrail(InsertActionServerAuditTrailView serverAudit)
 {
     AuditDao Dao = new AuditDao();
     String state = Dao.insertAudit(serverAudit);
     return CUDVerifyLogic.verifierInsertDeleteUpdate("insert", state);
 }
 private void accessReport(String report)
 {
     InsertActionServerAuditTrailView view = new InsertActionServerAuditTrailView();
     AuditService auditService = new AuditService();
     String reason = "User access " + report;
     String user = Context.User.Identity.Name;
     view.Reason = reason;
     view.StationIP = General.getIp(this.Page);
     view.UserName = user;
     view.Action = "View Report";
     view.NewValues = "N/A";
     auditService.insertAuditTrail(view);
 }