package com.iplatform.security.util; import com.iplatform.base.DefaultUserPrincipal; import com.iplatform.model.po.S_user_core; import com.walker.infrastructure.utils.DateUtils; import com.walker.web.DataStatus; import com.walker.web.UserPrincipal; import com.walker.web.UserType; public class MockPrincipalUtils { // /** // * 正式代码,创建超级管理员用户登录对象 // * @return // */ // public static final UserPrincipal createSupervisor(String supervisorPassword){ // S_user_core userCore = new S_user_core(); // userCore.setId(Constants.SUPERVISOR_ID); //// userCore.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); // userCore.setCreate_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); // userCore.setStatus(DataStatus.CONST_NORMAL); // userCore.setUser_name(Constants.SUPERVISOR_NAME_DEFAULT); // userCore.setNick_name(Constants.SUPERVISOR_NAME_ZH); //// userCore.setPassword("123456"); // 这里要修改,应该存储加密过后的密码信息 // userCore.setPassword(supervisorPassword); // userCore.setUser_type(UserType.TYPE_SUPER); // // DefaultUserPrincipal userPrincipal = new DefaultUserPrincipal(userCore); // return userPrincipal; // } /** * 模拟一个普通用户 * @param id 用户ID(以及登录ID) * @return */ @Deprecated public static final UserPrincipal createNormalUser(String id){ S_user_core userCore = new S_user_core(); userCore.setId(Long.parseLong(id)); // userCore.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); userCore.setCreate_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); userCore.setStatus(DataStatus.CONST_NORMAL); userCore.setUser_name(id); userCore.setNick_name("演示用户"); userCore.setPassword("123456"); // 这里要修改,应该存储加密过后的密码信息 userCore.setUser_type(UserType.TYPE_NORMAL); DefaultUserPrincipal userPrincipal = new DefaultUserPrincipal(userCore); return userPrincipal; } }