Examples of SecuredUser


Examples of net.datacrow.core.security.SecuredUser

       
        PluginHelper.addListener(buttonSave, "SaveAll", view.getModule().getIndex());
        PluginHelper.addListener(buttonRemove, "RemoveRow", view.getModule().getIndex());
   
        // Build the panel
        SecuredUser user = SecurityCentre.getInstance().getUser();
           
        if (user == null || user.isEditingAllowed(view.getModule()))
          panelActionsRight.add(buttonSave);
       
        buttonSave.setEnabled(user == null || user.isEditingAllowed(view.getModule()));
       
        if view.getType() == View._TYPE_INSERT &&
                (user == null || user.isEditingAllowed(view.getModule()))) {
            panelActionsLeft.add(buttonRemove);
            panelActionsLeft.add(buttonAdd);
        }
   
        for (Component c: view.getAdditionalActions())
            panelActionsLeft.add(c);
   
        if (view.getType() == View._TYPE_INSERT)
            panelActionsRight.add(buttonClear);
   
        if (user == null || user.isEditingAllowed(view.getModule()))
          panelActionsRight.add(buttonCancel);
       
        setLayout(Layout.getGBL());
        add(panelActionsLeft, Layout.getGBC(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0));
View Full Code Here

Examples of net.datacrow.core.security.SecuredUser

        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        DcWebUser wu = (DcWebUser) vr.resolveVariable(fc, "user");
       
        try {
            SecuredUser su = SecurityCentre.getInstance().login(wu.getUsername(), wu.getPassword(), true);
            wu.setSecuredUser(su);
            DcWebModules modules = (DcWebModules) vr.resolveVariable(fc, "modules");
            modules.load();
        } catch (SecurityException se) {
            fc.addMessage("loginError", new FacesMessage(se.getMessage()));
View Full Code Here

Examples of net.datacrow.core.security.SecuredUser

    private void changePassword() {
        String currentPass = String.valueOf(fldCurrentPassword.getPassword());
       
        try {
            SecurityCentre sc = SecurityCentre.getInstance();
            SecuredUser su = sc.login(sc.getUser().getUsername(), currentPass, false);
            if (su != null) {
               
                String newPass1 = String.valueOf(fldNewPassword1.getPassword());
                String newPass2 = String.valueOf(fldNewPassword2.getPassword());

                if (newPass1.length() == 0 || newPass2.length() == 0) {
                    DcSwingUtilities.displayMessage("msgPleaseEnterNewPassword");
                } else if (newPass1.equals(newPass2)){
                    sc.changePassword(su.getUser(), newPass1);
                    close();
                } else {
                    DcSwingUtilities.displayMessage("msgPasswordsDoNotMatch");
                }
               
View Full Code Here

Examples of net.datacrow.core.security.SecuredUser

     * Returns a new connection to the database based on the logged on user.
     */
    public static Connection getConnection() {
        if (isClosed(connection)) {
       
            SecuredUser su = SecurityCentre.getInstance().getUser();
            if (su == null)
                connection = getConnection("sa", "");
            else
                connection = getConnection(su.getUsername(), su.getPassword());
           
            logger.debug("Created a new, normal, database connection");
        }

        return connection;
View Full Code Here

Examples of org.ngrinder.security.SecuredUser

      user.setUserName("TEST_USER");
      user.setEmail("TEST_USER@nhn.com");
      user.setPassword("123");
      user.setRole(Role.USER);

      SecuredUser securedUser = new SecuredUser(user, null);
      String encodePassword = passwordEncoder.encodePassword(user.getPassword(), saltSource.getSalt(securedUser));
      user.setPassword(encodePassword);

      userRepository.save(user);
    }
View Full Code Here

Examples of org.ngrinder.security.SecuredUser

    }
    Object obj = auth.getPrincipal();
    if (!(obj instanceof SecuredUser)) {
      throw new AuthenticationCredentialsNotFoundException("Invalid authentication with " + obj);
    }
    SecuredUser securedUser = (SecuredUser) obj;
    return securedUser.getUser();
  }
View Full Code Here

Examples of org.ngrinder.security.SecuredUser

   *
   * @param user user
   */
  public void encodePassword(User user) {
    if (StringUtils.isNotBlank(user.getPassword())) {
      SecuredUser securedUser = new SecuredUser(user, null);
      String encodePassword = passwordEncoder.encodePassword(user.getPassword(), saltSource.getSalt(securedUser));
      user.setPassword(encodePassword);
    }
  }
View Full Code Here

Examples of org.ngrinder.security.SecuredUser

        .PROP_CONTROLLER_ADMIN_PASSWORD_RESET)) {
      final User admin = userRepository.findOneByUserId("admin");
      if (admin == null) {
        createUser("admin", "admin", Role.ADMIN, "admin", "admin@nhn.com");
      } else {
        SecuredUser securedUser = new SecuredUser(admin, null);
        Object salt = saltSource.getSalt(securedUser);
        admin.setRole(Role.ADMIN);
        admin.setPassword(passwordEncoder.encodePassword("admin", salt));
        userRepository.saveAndFlush(admin);
      }
View Full Code Here

Examples of org.ngrinder.security.SecuredUser

   */
  private void createUser(String userId, String password, Role role, String userName, String email) {
    if (userRepository.findOneByUserId(userId) == null) {
      User user = new User();
      user.setUserId(userId);
      SecuredUser securedUser = new SecuredUser(user, null);
      Object salt = saltSource.getSalt(securedUser);
      user.setPassword(passwordEncoder.encodePassword(password, salt));
      user.setRole(role);
      user.setUserName(userName);
      user.setEmail(email);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.