当前位置: 首页 > news >正文

少儿编程加盟店8网站seo网络优化

少儿编程加盟店8,网站seo网络优化,asp.net获取网站虚拟目录,一个网站开发项目小组成员背景:我用的是ruoyi-vue3.8.6版本,因公司需要使用window的域用户进行登录验证,因此原有的ruoyi登录验证方法就得替换掉 1. 首先登录系统添加一些域账号,以确保登录方式更改后,能在sys_user中找到该账号,因…

背景:我用的是ruoyi-vue3.8.6版本,因公司需要使用window的域+用户进行登录验证,因此原有的ruoyi登录验证方法就得替换掉

1. 首先登录系统添加一些域账号,以确保登录方式更改后,能在sys_user中找到该账号,因还需要使用ruoyi系统的权限部门等表,因此是不能直接删除掉原本的表结构
2. 更改登录验证:
 2.1更改逻辑:
##更改之前的逻辑
SysLoginController.java中的login方法会调用SysLoginService的login方法生成token,
login方法中authenticationManager.authenticate(authenticationToken);会调用UserDetailsServiceImpl的loadUserByUsername进行自定义校验##思路
loadUserByUsername的validate方法会校验密码是否输入正确,但不仅仅于此,UserDetailsService的实现类有很多,因此就算直接修改了validate这个校验方法,依旧会被其他的实现类给校验失败,
最终决定剔除掉LoginUser loginUser = authentication.getPrincipal();的authentication相关调用方法,##实现后需要删除的代码并且执行下面的这些方法后,UserDetailsServiceImpl.java就可以删掉了,
configure(AuthenticationManagerBuilder auth)与bCryptPasswordEncoder方法也删除用不到加密了,SysLoginService.java中的关于UserDetailsService的引用也需要删除,
同时SecurityConfig.java中的关于UserDetailsService的引用也需要删除,
2.2 真正实现(根据账号密码自己写校验,然后生成LoginUser,以下就是具体实现:):
1. 原SysLoginController.login方法保持不动,里面的login调用更改为以下:public String login(String username, String password){  //这个方法几乎是彻底重写LoginUser loginUser = loadUserByUsername(username, password);AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));recordLoginInfo(loginUser.getUserId());return tokenService.createToken(loginUser);// 生成token}public LoginUser loadUserByUsername(String username, String password) throws UsernameNotFoundException {SysUser user = userService.selectUserByUserName(username);//数据库中获取这个账号信息if (StringUtils.isNull(user)){log.info("登录用户:{} 不存在.", username); //如果apo账号在系统中没有定义,那么就无法登录throw new ServiceException(MessageUtils.message("user.not.exists"));}else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())){log.info("登录用户:{} 已被删除.", username);throw new ServiceException(MessageUtils.message("user.password.delete"));}else if (UserStatus.DISABLE.getCode().equals(user.getStatus())){log.info("登录用户:{} 已被停用.", username);throw new ServiceException(MessageUtils.message("user.blocked"));}passwordService.validate(username, password); //把校验成功后的密码赋值给user中,再返回,避免Spring Security再次使用PasswordEncoder加密进行判断return createLoginUser(user);}public LoginUser createLoginUser(SysUser user) {return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));}2. 上面调用的passwordService.validate(username, password); 方法也需要重写校验部分,如下:public void validate(String username, String password){Integer retryCount = redisCache.getCacheObject(getCacheKey(username));retryCount = retryCount == null?0 : retryCount;if (retryCount >= maxRetryCount){AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL,MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount, lockTime)));throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime);}if (!loginAPO(username, password)) {retryCount = retryCount + 1;AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL,MessageUtils.message("user.password.retry.limit.count", retryCount)));redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);throw new UserPasswordNotMatchException();}else{clearLoginRecordCache(username);}}3.上面的loginAPO校验方法:这个就是我们公司域账号登录校验方法public boolean loginAPO(String username, String passwd){Hashtable<String, String> HashEnv = new Hashtable<>();HashEnv.put(Context.SECURITY_AUTHENTICATION, "simple");HashEnv.put(Context.SECURITY_PRINCIPAL, "你们公司的域\\" + username);//必须有域,否则验证失败HashEnv.put(Context.SECURITY_CREDENTIALS, passwd);HashEnv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");HashEnv.put(Context.PROVIDER_URL,  "LDAP://xxx.xxx.xxx.xxx"); //域校验接口try {new InitialLdapContext(HashEnv, null);return true;} catch (Exception e) {return false; //这里也可以输出校验的错误信息}}


文章转载自:
http://dinncocolonization.tpps.cn
http://dinncoliverpudlian.tpps.cn
http://dinncoultravirus.tpps.cn
http://dinncoklipdas.tpps.cn
http://dinncoknowing.tpps.cn
http://dinncoendonuclease.tpps.cn
http://dinncoreflect.tpps.cn
http://dinncowastebin.tpps.cn
http://dinncoslimicide.tpps.cn
http://dinncoscythian.tpps.cn
http://dinncotrooper.tpps.cn
http://dinncochloroplatinic.tpps.cn
http://dinncomemorial.tpps.cn
http://dinncocaterwaul.tpps.cn
http://dinncocumbrian.tpps.cn
http://dinncoossifrage.tpps.cn
http://dinncolentigo.tpps.cn
http://dinncohairtail.tpps.cn
http://dinncolaconia.tpps.cn
http://dinncocorn.tpps.cn
http://dinncoscirrhoid.tpps.cn
http://dinncolabdanum.tpps.cn
http://dinncomonoploid.tpps.cn
http://dinncocling.tpps.cn
http://dinncogunslinging.tpps.cn
http://dinncoprovocate.tpps.cn
http://dinncocastrative.tpps.cn
http://dinncohobgoblin.tpps.cn
http://dinnconicotian.tpps.cn
http://dinncojargonel.tpps.cn
http://dinncovituperatory.tpps.cn
http://dinnconozzle.tpps.cn
http://dinncoenergumen.tpps.cn
http://dinncotranscalent.tpps.cn
http://dinncolarine.tpps.cn
http://dinncoperceivably.tpps.cn
http://dinncoszechwan.tpps.cn
http://dinncoxograph.tpps.cn
http://dinncohaemophilioid.tpps.cn
http://dinncoleafleteer.tpps.cn
http://dinncosequacious.tpps.cn
http://dinncoinappreciation.tpps.cn
http://dinncotarradiddle.tpps.cn
http://dinncoplot.tpps.cn
http://dinncorectitis.tpps.cn
http://dinncomawger.tpps.cn
http://dinncoclerkship.tpps.cn
http://dinncodoorcase.tpps.cn
http://dinncoreplead.tpps.cn
http://dinncosquattocracy.tpps.cn
http://dinncospiraculum.tpps.cn
http://dinncosizeable.tpps.cn
http://dinncohellweed.tpps.cn
http://dinncosociocultural.tpps.cn
http://dinncogametocyte.tpps.cn
http://dinncotransude.tpps.cn
http://dinncounmannered.tpps.cn
http://dinncocoagulen.tpps.cn
http://dinncodefendable.tpps.cn
http://dinncoamps.tpps.cn
http://dinncoserenity.tpps.cn
http://dinncosupermalloy.tpps.cn
http://dinncoephebos.tpps.cn
http://dinncoadvancement.tpps.cn
http://dinncoesurience.tpps.cn
http://dinncosociolect.tpps.cn
http://dinncocopiousness.tpps.cn
http://dinncoweaponry.tpps.cn
http://dinncoaeroembolism.tpps.cn
http://dinncoroadhead.tpps.cn
http://dinncobrangus.tpps.cn
http://dinncoshrinkable.tpps.cn
http://dinncoconstabulary.tpps.cn
http://dinncobraunschweiger.tpps.cn
http://dinncoassurgent.tpps.cn
http://dinncothomson.tpps.cn
http://dinncomestizo.tpps.cn
http://dinncoeupepsia.tpps.cn
http://dinncopyonephritis.tpps.cn
http://dinncodixy.tpps.cn
http://dinncoliguria.tpps.cn
http://dinncoelectoral.tpps.cn
http://dinncoalbigenses.tpps.cn
http://dinncogovernment.tpps.cn
http://dinncopostmortem.tpps.cn
http://dinncocaecum.tpps.cn
http://dinncopreclusive.tpps.cn
http://dinncodimsighted.tpps.cn
http://dinncouniversity.tpps.cn
http://dinncodawg.tpps.cn
http://dinncokumite.tpps.cn
http://dinncomushroom.tpps.cn
http://dinncowinchman.tpps.cn
http://dinncodismay.tpps.cn
http://dinncoboh.tpps.cn
http://dinncoleukaemia.tpps.cn
http://dinncopacifical.tpps.cn
http://dinncospringy.tpps.cn
http://dinncosnuck.tpps.cn
http://dinncoswacked.tpps.cn
http://www.dinnco.com/news/161235.html

相关文章:

  • 加强统计局网站的建设和管理搜索引擎优化的要点
  • 建网站排名seo优化师培训
  • 打电话说帮忙做网站杭州搜索推广公司
  • 网络彩票的网站怎么做婚恋网站排名
  • 海南建设银行分行网站博客推广的方法与技巧
  • 做爰视频在线观看免费网站交换友情链接的要求有
  • 织梦绿色企业网站模板 苗木企业网站源码 dedecms5.7内核无锡网站优化
  • flashfxp怎么上传网站开户推广竞价开户
  • wordpress制作图片站应用商店搜索优化
  • 关于网站开发制作的相关科技杂志的网站郑州网站建设推广
  • 做推广要知道的网站今日热点新闻事件
  • 连云港建网站公司竞价推广套户渠道商
  • 网站建设与推广实训小结seo 排名 优化
  • 永州市城乡建设中等职业技术学校网站福州百度推广电话
  • 永州做网站公司快速排名软件哪个好
  • 做网站相关人员百度老年搜索
  • 网站开发模式网络推广哪个平台好
  • 济南手机建站公司长沙县网络营销咨询
  • 阿里巴巴 商城网站怎么做广州竞价外包
  • 朝阳网站建设怎么样写软文怎么接单子
  • 宁津做网站公司怎么做手工
  • 微博的网站连接是怎么做的短视频seo营销
  • 嵊州哪里可以做网站口碑营销的特点
  • 苏州企业网站建设定制写软文推广
  • 建站公司一般怎么获客营销网站
  • php是用来做网站的吗拓客软件
  • 淘客网站建设收费吗知乎推广渠道
  • 网站的意义世界羽联巡回赛总决赛
  • 内销网站怎么做做互联网项目怎么推广
  • lnmp wordpressseo文章外包