public HomeController(ISeguridadService pSeguridadService,
                       IProductoService pProductoService
                       )
 {
     seguridadService = pSeguridadService;
     productoService  = pProductoService;
 }
示例#2
0
        private void Bindear()
        {
            if (clienteCurrent.Id != 0)
            {
                this.txtRazonSocial.Text                = clienteCurrent.RazonSocial;
                this.txtCuit.Text                       = clienteCurrent.CUIT.ToString();
                this.txtNombreContacto.Text             = clienteCurrent.NombreContacto;
                this.txtApellidoContacto.Text           = clienteCurrent.ApellidoContacto;
                this.txtEmailContacto.Text              = clienteCurrent.EmailContacto;
                this.txtNombreContactoSecundario.Text   = clienteCurrent.NombreContactoSecundario;
                this.txtApellidoContactoSecundario.Text = clienteCurrent.ApellidoContactoSecundario;
                this.txtEmailContactoSecundario.Text    = clienteCurrent.EmailContactoSecundario;
                this.chkCalculaVencimientoConVisualizacionDoc.Checked = clienteCurrent.CalculaVencimientoConVisualizacionDoc;

                // asigno usuario
                ISeguridadService seguridadSvc = ServiceFactory.GetSecurityService();
                UsuarioDto        usuario      = seguridadSvc.ObtenerUsuario(clienteCurrent.UsuarioId);
                if (usuario != null)
                {
                    this.txtNombreUsuario.Text = usuario.NombreUsuario;
                    this.pnlUsuario.Visible    = true;
                }
                else
                {
                    this.pnlUsuario.Visible = false;
                }
            }
            else
            {
                btnVerAuditoria.Visible = false;
            }
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HasPermissionToSeeMe(Operaciones.UsuarioDetalle);
            try
            {
                seguridadService = ServiceFactory.GetSecurityService();

                if (!this.IsPostBack)
                {
                    if (this.Request.QueryString["Id"] == null)
                    {
                        usuarioCurrent = new UsuarioDto();
                    }
                    else
                    {
                        usuarioCurrent = seguridadService.ObtenerUsuario(Convert.ToInt64(this.Request.QueryString["Id"]));
                    }
                    InicializarListControls();
                    this.pnlPassword.Visible = usuarioCurrent.Id == 0;
                    Bindear();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Instance.HandleException(ex);
            }
        }
 public SeguridadController(ISeguridadService seguridadService, IMapper mapper, IPerfilService perfilService, IUsuarioService usuarioService)
 {
     this._seguridadService = seguridadService;
     this._mapper           = mapper;
     this._perfilService    = perfilService;
     this._usuarioService   = usuarioService;
 }
示例#5
0
        public SeguridadUnitTest()
        {
            this.componentContainer = new ComponentContainer();

            this.componentContainer.Register <ISeguridadService, SeguridadService>();
            this.componentContainer.Register <IListaLinealService, ListaLinealService>();

            this.iSeguridadService = componentContainer.Resolve <ISeguridadService>();
            this.iListaLineal      = componentContainer.Resolve <IListaLinealService>();
        }
示例#6
0
 public TokenController(
     IConfiguration configuration,
     ISeguridadService seguridadService,
     IPasswordService passwordService,
     IUnitOfWork unitOfWork
     )
 {
     _configuration    = configuration;
     _seguridadService = seguridadService;
     _passwordService  = passwordService;
     _unitOfWork       = unitOfWork;
 }
 public SeguridadController(ISeguridadService seguridadService,
                            IUsuarioService usuarioService,
                            ITokenAccesoService tokenAccesoService,
                            IHttpContextAccessor httpContext,
                            IApplicacionLlaveService applicacionLlaveService)
     : base(httpContext)
 {
     this.seguridadService        = seguridadService;
     this.usuarioService          = usuarioService;
     this.tokenAccesoService      = tokenAccesoService;
     this.httpContext             = httpContext;
     this.applicacionLlaveService = applicacionLlaveService;
 }
示例#8
0
        public ModuloServiceUnitTest()
        {
            this.componentContainer = new ComponentContainer();

            this.componentContainer.Register <IModuloService, ModuloService>();
            this.componentContainer.Register <IPlantillaService, PlantillaService>();
            this.componentContainer.Register <ICategoriasService, CategoriaService>();
            this.componentContainer.Register <ISeguridadService, SeguridadService>();

            this.iModuloService    = componentContainer.Resolve <IModuloService>();
            this.iPlantillaService = componentContainer.Resolve <IPlantillaService>();
            this.iCategoriaService = componentContainer.Resolve <ICategoriasService>();
            this.iSeguridadService = componentContainer.Resolve <ISeguridadService>();
        }
示例#9
0
        public static void Configure(IAppBuilder app,
                                     HttpConfiguration config)
        {
            ISeguridadService seguridadService =
                (ISeguridadService)config.DependencyResolver.GetService(typeof(ISeguridadService));

            var oAuthOptions = new OAuthAuthorizationServerOptions()
            {
                AllowInsecureHttp         = true,
                TokenEndpointPath         = new Microsoft.Owin.PathString("/login"),
                AccessTokenExpireTimeSpan = TimeSpan.FromSeconds(40),
                Provider = new SecurityProvider(seguridadService)
            };

            app.UseOAuthAuthorizationServer(oAuthOptions);
            app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
        }
示例#10
0
        public bool IsInRole(string role)
        {
            bool isInRole                = false;
            ISeguridadService svc        = ServiceFactory.GetSecurityService();
            UsuarioDto        usuarioDto = svc.ObtenerUsuario(this.customIdentity.Name);

            if (usuarioDto != null &&
                usuarioDto.Roles != null &&
                usuarioDto.Roles.Count > 0)
            {
                foreach (var rol in usuarioDto.Roles)
                {
                    if (rol.Codigo == role)
                    {
                        isInRole = true;
                        break;
                    }
                }
            }
            return(isInRole);
        }
示例#11
0
        protected void ChangePasswordPushButton_Click(object sender, EventArgs e)
        {
            try
            {
                string passwordActual = this.CurrentPassword.Text.Trim();
                string passwordNueva  = this.NewPassword.Text.Trim();

                ISeguridadService seguridadService = ServiceFactory.GetSecurityService();
                seguridadService.CambiarPassword(this.BaseMaster.UserName, passwordActual, passwordNueva);
                ShowMessage("Los datos fueron grabados con éxito", WebMessageType.Notification);
                this.SignOut();
            }
            catch (Exception ex)
            {
                CustomValidator validator = new CustomValidator();
                validator.IsValid           = false;
                validator.ValidationGroup   = "ChangeUserPasswordValidationGroup";
                validator.Text              = "*";
                validator.ControlToValidate = "CurrentPassword";
                validator.ErrorMessage      = ex.Message;
                this.Validators.Add(validator);
            }
        }
示例#12
0
 public HomeController(ISeguridadService pseguridadServices)
 {
     seguridadServices = pseguridadServices;
 }
 public UsuariosController(IUsuarioService usuarioService,
                           ISeguridadService seguridadService, IConfiguration configuration)
 {
     _usuarioService = usuarioService;
     _configuration  = configuration;
 }
示例#14
0
        protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
        {
            ISeguridadService svc = ServiceFactory.GetSecurityService();

            try
            {
                if (svc.AutenticarUsuario(this.LoginUser.UserName, this.LoginUser.Password))
                {
                    UsuarioDto usuario = this.ObtenerUsuario(this.LoginUser.UserName.Trim());

                    // Query the user store to get this user's User Data
                    string userDataString = string.Format("{0}|{1}", usuario.Id, usuario.ClienteId);

                    // Create the cookie that contains the forms authentication ticket
                    HttpCookie authCookie = FormsAuthentication.GetAuthCookie(usuario.NombreUsuario, false);

                    // Get the FormsAuthenticationTicket out of the encrypted cookie
                    FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);

                    // Create a new FormsAuthenticationTicket that includes our custom User Data
                    FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, ticket.IssueDate, ticket.Expiration, ticket.IsPersistent, userDataString);

                    // Update the authCookie's Value to use the encrypted version of newTicket
                    authCookie.Value = FormsAuthentication.Encrypt(newTicket);

                    // Manually add the authCookie to the Cookies collection
                    Response.Cookies.Add(authCookie);

                    // Determine redirect URL and send user there
                    string redirUrl = FormsAuthentication.GetRedirectUrl(usuario.NombreUsuario, false);
                    if (String.IsNullOrEmpty(redirUrl))
                    {
                        redirUrl = "~/Default.aspx";
                    }

                    Response.Redirect(redirUrl);


                    ////LoginData loginData = new LoginData();
                    ////loginData.UsuarioId = usuario.Id;
                    ////loginData.ClienteId = usuario.ClienteId;
                    ////loginData.Roles = this.GetRolesDelimitedByComma(usuario.Roles);
                    //CustomIdentity identity = new CustomIdentity();
                    //identity.Usuario = usuario;
                    //IPrincipal principal = new CustomPrincipal(identity);
                    //// Attach the CustomPrincipal to HttpContext.User and Thread.CurrentPrincipal
                    //HttpContext.Current.User = principal;
                    //Thread.CurrentPrincipal = principal;


                    //FormsAuthentication.RedirectFromLoginPage(this.LoginUser.UserName, false);
                }
                else
                {
                    this.AgregarErrorDeLogin();
                }
            }
            catch (Exception ex)
            {
                AgregarErrorDeLogin();
            }
        }
示例#15
0
 public SeguridadController(ISeguridadService pSeguridadService)
 {
     seguridadService = pSeguridadService;
 }
 public CuentaController(ISeguridadService seguridadService,
                         IUsuarioService usuarioService)
 {
     _seguridadService = seguridadService;
     _usuarioService   = usuarioService;
 }
示例#17
0
 public SeguridadController(ISeguridadService seguridadService, IMapper mapper)
 {
     _seguridadService = seguridadService;
     _mapper           = mapper;
 }
 public CesarController(ISeguridadService <string> VigenereSeguridadService)
 {
     _seguridadService = VigenereSeguridadService;
 }
示例#19
0
 public CesarController(ISeguridadService <string> seguridadService)
 {
     _seguridadService = seguridadService;
 }
示例#20
0
 public AccountController(ISeguridadService seguridadService, IHostingEnvironment environment)
 {
     _seguridadService = seguridadService;
     _environment      = environment;
 }
示例#21
0
 public VigenereController(ISeguridadService <string> seguridadService)
 {
     _seguridadService = seguridadService;
 }
示例#22
0
 public SeguridadController(IConfiguration configuration, ISeguridadService seguridadService, IMemoryCache cache)
 {
     this.configuration    = configuration;
     this.seguridadService = seguridadService;
     this.cache            = cache;
 }
 public SeguridadController(ILogger <SeguridadController> logger, ISeguridadService seguridadService, IConfiguration configuration)
 {
     _logger           = logger;
     _seguridadService = seguridadService;
     _configuration    = configuration;
 }
示例#24
0
 public TokenController(IConfiguration configutarion, ISeguridadService seguridadService)
 {
     _configutarion    = configutarion;
     _seguridadService = seguridadService;
 }
 public SecurityProvider(ISeguridadService seguridadService)
 {
     this.seguridadService = seguridadService;
 }
示例#26
0
        public CesarController(ISeguridadService <int> seguridadService)

        {
            _seguridadService = seguridadService;
        }
示例#27
0
 public SeguridadController(ISeguridadService seguridadService)
 {
     _seguridadService = seguridadService;
 }
示例#28
0
        private UsuarioDto ObtenerUsuario(string userName)
        {
            ISeguridadService svc = ServiceFactory.GetSecurityService();

            return(svc.ObtenerUsuario(userName));
        }
示例#29
0
 public UsuariosController(IUsuarioDAOService usuarioService, ISeguridadService seguridadService)
 {
     _usuarioService   = usuarioService;
     _seguridadService = seguridadService;
 }