Examples of User


Examples of com.github.zhangkaitao.shiro.chapter19.entity.User

    }

    @RequestMapping(value = "/create", method = RequestMethod.GET)
    public String showCreateForm(Model model) {
        setCommonData(model);
        model.addAttribute("user", new User());
        model.addAttribute("op", "新增");
        return "user/edit";
    }
View Full Code Here

Examples of com.github.zhangkaitao.shiro.chapter21.entity.User

        return s.toString();
    }

    public static String username(Long userId) {
        User user = getUserService().findOne(userId);
        if(user == null) {
            return "";
        }
        return user.getUsername();
    }
View Full Code Here

Examples of com.github.zhangkaitao.shiro.chapter22.entity.User

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {

        String username = (String)token.getPrincipal();

        User user = userService.findByUsername(username);

        if(user == null) {
            throw new UnknownAccountException();//没找到帐号
        }

        if(Boolean.TRUE.equals(user.getLocked())) {
            throw new LockedAccountException(); //帐号锁定
        }

        //交给AuthenticatingRealm使用CredentialsMatcher进行密码匹配,如果觉得人家的不好可以自定义实现
        SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(
                user.getUsername(), //用户名
                user.getPassword(), //密码
                ByteSource.Util.bytes(user.getCredentialsSalt()),//salt=username+salt
                getName()  //realm name
        );
        return authenticationInfo;
    }
View Full Code Here

Examples of com.github.zhangkaitao.shiro.chapter23.entity.User

     * 修改密码
     * @param userId
     * @param newPassword
     */
    public void changePassword(Long userId, String newPassword) {
        User user =userDao.findOne(userId);
        user.setPassword(newPassword);
        passwordHelper.encryptPassword(user);
        userDao.updateUser(user);
    }
View Full Code Here

Examples of com.github.zhangkaitao.shiro.chapter24.entity.User

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {

        String username = (String)token.getPrincipal();

        User user = userService.findByUsername(username);

        if(user == null) {
            throw new UnknownAccountException();//没找到帐号
        }

        if(Boolean.TRUE.equals(user.getLocked())) {
            throw new LockedAccountException(); //帐号锁定
        }

        //交给AuthenticatingRealm使用CredentialsMatcher进行密码匹配,如果觉得人家的不好可以自定义实现
        SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(
                user.getUsername(), //用户名
                user.getPassword(), //密码
                ByteSource.Util.bytes(user.getCredentialsSalt()),//salt=username+salt
                getName()  //realm name
        );
        return authenticationInfo;
    }
View Full Code Here

Examples of com.github.zhangkaitao.shiro.chapter6.entity.User

     * 修改密码
     * @param userId
     * @param newPassword
     */
    public void changePassword(Long userId, String newPassword) {
        User user =userDao.findOne(userId);
        user.setPassword(newPassword);
        passwordHelper.encryptPassword(user);
        userDao.updateUser(user);
    }
View Full Code Here

Examples of com.givens.springdata.model.User

    @RequestMapping(value = {"/searchuser"}, method = RequestMethod.GET)
    public @ResponseBody
    String getUser(@RequestParam(value = "username") String username) {

        System.out.println("Search for: " + username);
        User u = userService.readByUsername(username);
        String json = "";
        if (u != null) {
            json = u.toString();
        }
        return json;
    }
View Full Code Here

Examples of com.gnizr.db.dao.User

   
    IndexBookmark action = new IndexBookmark();
    action.setBookmarkPager(bookmarkPager);
    action.setSearchIndexManager(searchIndexManager);
    action.setUserManager(new UserManager(getGnizrDao()));
    action.setUser(new User(1));
    action.setSession(session);
   
    String doc1Hash = "d1a8e491759cb30d11357c4776be9c66";
    Document d1 = searchIndexManager.findLeadDocument(doc1Hash);
    assertNull(d1);
View Full Code Here

Examples of com.google.api.ads.dfa.axis.v1_19.User

          throws Exception {
    // Request the user service.
    UserRemote userService = dfaServices.get(session, UserRemote.class);

    // Retrieve the user who is to be modified.
    User user = userService.getUser(userId);

    // Create and configure a user filter.
    UserFilter filterToAdd = new UserFilter();
    // The following field has been filled in to make a filter that allows a
    // user to access only the assigned objects.
    // This value was determined using GetUserFilterCriteriaTypes.java.
    filterToAdd.setUserFilterCriteriaId(2);
    // Because this filter used the criteria type "Assigned" it is necessary
    // to specify what advertisers this user has access to. This next step
    // would be skipped for the criteria types "All" and "None".

    // Create an object filter to represent each object the user has access
    // to. Since this is an advertiser filter, an object filter represents an
    // advertiser. The total of object filter objects will need to match the
    // total of advertisers the user is assigned.
    ObjectFilter allowedObject = new ObjectFilter();
    // Insert the advertiser ID of an advertiser assigned to this user.
    allowedObject.setId(advertiserId);
    // Create any additional object filters that are needed, then create an
    // array of all of the object filters for this filter.
    ObjectFilter[] objectFilters = {allowedObject};
    // Add these settings to the user filter
    filterToAdd.setObjectFilters(objectFilters);

    // Add the filter to the user. The following method is specific to
    // advertiser filters. See the User class documentation for the names of
    // methods for other filters.
    user.setAdvertiserUserFilter(filterToAdd);

    // Save the changes made and display a success message.
    UserSaveResult userSaveResult = userService.saveUser(user);
    System.out.printf("User with ID \"%s\" was modified.", userSaveResult.getId());
  }
View Full Code Here

Examples of com.google.api.ads.dfa.axis.v1_20.User

          throws Exception {
    // Request the user service.
    UserRemote userService = dfaServices.get(session, UserRemote.class);

    // Retrieve the user who is to be modified.
    User user = userService.getUser(userId);

    // Create and configure a user filter.
    UserFilter filterToAdd = new UserFilter();
    // The following field has been filled in to make a filter that allows a
    // user to access only the assigned objects.
    // This value was determined using GetUserFilterCriteriaTypes.java.
    filterToAdd.setUserFilterCriteriaId(2);
    // Because this filter used the criteria type "Assigned" it is necessary
    // to specify what advertisers this user has access to. This next step
    // would be skipped for the criteria types "All" and "None".

    // Create an object filter to represent each object the user has access
    // to. Since this is an advertiser filter, an object filter represents an
    // advertiser. The total of object filter objects will need to match the
    // total of advertisers the user is assigned.
    ObjectFilter allowedObject = new ObjectFilter();
    // Insert the advertiser ID of an advertiser assigned to this user.
    allowedObject.setId(advertiserId);
    // Create any additional object filters that are needed, then create an
    // array of all of the object filters for this filter.
    ObjectFilter[] objectFilters = {allowedObject};
    // Add these settings to the user filter
    filterToAdd.setObjectFilters(objectFilters);

    // Add the filter to the user. The following method is specific to
    // advertiser filters. See the User class documentation for the names of
    // methods for other filters.
    user.setAdvertiserUserFilter(filterToAdd);

    // Save the changes made and display a success message.
    UserSaveResult userSaveResult = userService.saveUser(user);
    System.out.printf("User with ID \"%s\" was modified.", userSaveResult.getId());
  }
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.