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

猎头自己在哪个网站做单百度推广后台登陆入口

猎头自己在哪个网站做单,百度推广后台登陆入口,网站打开的速度慢,违章建设举报网站spring防止爬虫Spring Security可以为您做很多事情。 帐户被封锁#xff0c;密码盐。 但是蛮力阻断剂呢#xff1f; 那是你必须自己做的。 幸运的是#xff0c;Spring是一个非常灵活的框架#xff0c;因此对其进行配置并不是什么大问题。 让我向您展示一些如何针对Grai… spring防止爬虫 Spring Security可以为您做很多事情。 帐户被封锁密码盐。 但是蛮力阻断剂呢 那是你必须自己做的。 幸运的是Spring是一个非常灵活的框架因此对其进行配置并不是什么大问题。 让我向您展示一些如何针对Grails应用程序执行此操作的指南。 首先您必须在config.groovy中启用springSecurityEventListener grails.plugins.springsecurity.useSecurityEventListener true 然后实现监听器 在/ src / bruteforce中创建类 /** Registers all failed attempts to login. Main purpose to count attempts for particular account ant block user*/ class AuthenticationFailureListener implements ApplicationListener {LoginAttemptCacheService loginAttemptCacheServiceOverridevoid onApplicationEvent(AuthenticationFailureBadCredentialsEvent e) {loginAttemptCacheService.failLogin(e.authentication.name)} } 接下来我们必须创建侦听器以成功登录 在同一包装中 /**Listener for successfull logins. Used for reseting number on unsuccessfull logins for specific account */ class AuthenticationSuccessEventListener implements ApplicationListener{LoginAttemptCacheService loginAttemptCacheServiceOverridevoid onApplicationEvent(AuthenticationSuccessEvent e) {loginAttemptCacheService.loginSuccess(e.authentication.name)} } 我们没有将它们放在grails-app文件夹中因此我们需要将这些类作为spring bean重新命名。 在grails-app / conf / spring / resources.groovy中添加下一行 beans {authenticationFailureListener(AuthenticationFailureListener) {loginAttemptCacheService ref(loginAttemptCacheService)}authenticationSuccessEventListener(AuthenticationSuccessEventListener) {loginAttemptCacheService ref(loginAttemptCacheService)} } 您可能会注意到LoginAttemptCacheService loginAttemptCacheService的用法 让我们实现它。 这将是典型的grails服务 package com.picsel.officeanywhereimport com.google.common.cache.CacheBuilder import com.google.common.cache.CacheLoader import com.google.common.cache.LoadingCacheimport java.util.concurrent.TimeUnit import org.apache.commons.lang.math.NumberUtils import javax.annotation.PostConstructclass LoginAttemptCacheService {private LoadingCacheattempts;private int allowedNumberOfAttemptsdef grailsApplicationPostConstructvoid init() {allowedNumberOfAttempts grailsApplication.config.brutforce.loginAttempts.allowedNumberOfAttemptsint time grailsApplication.config.brutforce.loginAttempts.timelog.info account block configured for $time minutesattempts CacheBuilder.newBuilder().expireAfterWrite(time, TimeUnit.MINUTES).build({0} as CacheLoader);}/*** Triggers on each unsuccessful login attempt and increases number of attempts in local accumulator* param login - username which is trying to login* return*/def failLogin(String login) {def numberOfAttempts attempts.get(login)log.debug fail login $login previous number for attempts $numberOfAttemptsnumberOfAttemptsif (numberOfAttempts allowedNumberOfAttempts) {blockUser(login)attempts.invalidate(login)} else {attempts.put(login, numberOfAttempts)}}/*** Triggers on each successful login attempt and resets number of attempts in local accumulator* param login - username which is login*/def loginSuccess(String login) {log.debug successfull login for $loginattempts.invalidate(login)}/*** Disable user account so it would not able to login* param login - username that has to be disabled*/private void blockUser(String login) {log.debug blocking user: $logindef user User.findByUsername(login)if (user) {user.accountLocked true;user.save(flush: true)}} } 我们将使用Google番石榴库中的CacheBuilder。 因此将下一行添加到BuildConfig.groovy dependencies {runtime com.google.guava:guava:11.0.1} 最后一步将服务配置添加到cinfig.groovy brutforce {loginAttempts {time 5allowedNumberOfAttempts 3} 就是这样您准备运行您的应用程序。 对于典型的Java项目几乎一切都是一样的。 相同的侦听器和相同的服务。 有关Spring Security Events的更多信息 有关使用Google番石榴进行缓存的更多信息 Grails用户可以简单地使用此插件https://github.com/grygoriy/bruteforcedefender 祝您编程愉快别忘了分享 参考在Grygoriy Mykhalyuno的博客博客中我们的JCG合作伙伴 Grygoriy Mykhalyuno 使用Spring Security防止了暴力攻击 。 翻译自: https://www.javacodegeeks.com/2012/10/spring-security-prevent-brute-force.htmlspring防止爬虫
http://www.zqtcl.cn/news/645109/

相关文章:

  • 品牌网站制作方案如何写推广软文
  • o2o营销seo薪酬如何
  • 网站开发公司 网站空间推广网站制作
  • 鞍山网站制作小程序WordPress网盘下载插件
  • 保山市建设厅官方网站郑州建设信息网站
  • clh网站建设公司h5网站源代码
  • 做装修的网站怎么做好服装市场调网站建设的目的
  • 佛山网站建站电子工程网名又知道你是做工程
  • 桐乡网站二次开发商城购物网站建设
  • 大连微网站制作公司网页多钱
  • 郑州网站托管助企网络营销推广合作
  • 做电商网站用什么软件企业网站建设方案范本
  • o2o商城网站搭建潍坊定制网站搭建
  • 网站建设费用说明青岛网站建设方案公司
  • 佛山市建设企业网站服务机构优化seo是什么
  • 仿70网站分类目录源码市场营销策划ppt免费模板
  • 广东圆心科技网站开发网站模板设计网页程序代码
  • 网站平台定制开发一级a做爰网站下载
  • 网站如何做流媒体wordpress导出软件
  • 电商网站流程图esp8266做网站
  • 细胞医疗 网站模版免费网址软件
  • app地推网企业seo解决方案
  • php网站转移网吧手机网站模版
  • 北京建设教育网站今天的国内新闻
  • 江苏省建设银行网站天心区网站建设公司
  • 网站分享设计网站备案收费么
  • 手机网站专题关于asp sql网站开发的书籍
  • 网站建设属于什么领域小米发布会在哪里看
  • 免费空间访客领取网站提高网站互动性
  • 湖北省市政工程建设网站汉中网站建设电话