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

网站备案应该怎么做手机端竞价恶意点击能防止吗

网站备案应该怎么做,手机端竞价恶意点击能防止吗,阳江企业网站建设,云端网站建设项目代码 gson/spring-security-demo 简介 Spring Security 是 Spring 家族中的一个安全管理框架。相比与另外一个安全框架Shiro,它提供了更丰富的功能,社区资源也比Shiro丰富。 一般来说中大型的项目都是使用SpringSecurity来做安全框架。小项目有Shiro的比较多,因为相比…

项目代码

gson/spring-security-demo


简介

Spring Security 是 Spring 家族中的一个安全管理框架。相比与另外一个安全框架Shiro,它提供了更丰富的功能,社区资源也比Shiro丰富。

一般来说中大型的项目都是使用SpringSecurity来做安全框架。小项目有Shiro的比较多,因为相比与SpringSecurity,Shiro的上手更加的简单。

一般Web应用的需要进行认证授权

认证:验证当前访问系统的是不是本系统的用户,并且要确认具体是哪个用户

授权:经过认证后判断当前用户是否有权限进行某个操作

而认证和授权也是SpringSecurity作为安全框架的核心功能。


搭建基础项目

1、我们先搭建一个简单的SpringBoot工程,并添加相关依赖

 <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.5.0</version></parent><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency></dependencies>

2、创建启动类

@SpringBootApplication
public class SecurityApplication {public static void main(String[] args) {SpringApplication.run(SecurityApplication.class,args);}
}

3、创建Controller

@RestController
@RequestMapping("/book")
public class BookController {@GetMapping("/list")public String list() {return "book-list";}}

4、创建配置文件application.yml

server:port: 8000

然后启动项目,输入地址进行访问测试


引入SpringSecurity

在SpringBoot项目中使用SpringSecurity我们只需要引入依赖即可实现入门案例。

       <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency>

引入依赖后我们在尝试去访问之前的接口就会自动跳转到一个SpringSecurity的默认登陆页面,默认用户名是user,密码会输出在控制台。

必须登陆之后才能对接口进行访问。


认证

登陆校验流程

SpringSecurity完整流程

SpringSecurity的原理其实就是一个过滤器链,内部包含了提供各种功能的过滤器。这里我们可以看看入门案例中的过滤器。

图中只展示了核心过滤器,其它的非核心过滤器并没有在图中展示。

UsernamePasswordAuthenticationFilter:负责处理我们在登陆页面填写了用户名密码后的登陆请求。入门案例的认证工作主要有它负责。

ExceptionTranslationFilter:处理过滤器链中抛出的任何AccessDeniedException和AuthenticationException 。

FilterSecurityInterceptor:负责权限校验的过滤器。

我们可以通过Debug查看当前系统中SpringSecurity过滤器链中有哪些过滤器及它们的顺序。

认证流程详解

概念速查:

  • Authentication接口: 它的实现类,表示当前访问系统的用户,封装了用户相关信息。
  • AuthenticationManager接口:定义了认证Authentication的方法
  • UserDetailsService接口:加载用户特定数据的核心接口。里面定义了一个根据用户名查询用户信息的方法。
  • UserDetails接口:提供核心用户信息。通过UserDetailsService根据用户名获取处理的用户信息要封装成UserDetails对象返回。然后将这些信息封装到Authentication对象中。

登录过程分析

登录

①自定义登录接口

  • 调用ProviderManager的方法进行认证 如果认证通过生成jwt,
  • 把用户信息存入redis中

②自定义UserDetailsService

  • 在这个实现类中去查询数据库

校验:

①定义Jwt认证过滤器

  • 获取token
  • 解析token获取其中的userid
  • 从redis中获取用户信息
  • 存入SecurityContextHolder

代码准备工作

1、添加依赖

        <!--redis依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><!--fastjson依赖--><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>1.2.33</version></dependency><!--jwt依赖--><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt</artifactId><version>0.9.0</version></dependency><!-- 引入MybatisPuls和mysql驱动的依赖--><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.4.3</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><!-- 单元测试的依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId></dependency>

2、添加Redis相关配置

/*** Redis使用FastJson序列化** @author sg*/
public class FastJsonRedisSerializer<T> implements RedisSerializer<T>
{public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");private Class<T> clazz;static{ParserConfig.getGlobalInstance().setAutoTypeSupport(true);}public FastJsonRedisSerializer(Class<T> clazz){super();this.clazz = clazz;}@Overridepublic byte[] serialize(T t) throws SerializationException{if (t == null){return new byte[0];}return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET);}@Overridepublic T deserialize(byte[] bytes) throws SerializationException{if (bytes == null || bytes.length <= 0){return null;}String str

文章转载自:
http://dinncorecoinage.zfyr.cn
http://dinncoencephala.zfyr.cn
http://dinncopostage.zfyr.cn
http://dinncoconservancy.zfyr.cn
http://dinncoethylamine.zfyr.cn
http://dinncoforgave.zfyr.cn
http://dinncopumice.zfyr.cn
http://dinncocaliga.zfyr.cn
http://dinncoerythema.zfyr.cn
http://dinncopostpositive.zfyr.cn
http://dinncoawag.zfyr.cn
http://dinncopunditry.zfyr.cn
http://dinnconesselrode.zfyr.cn
http://dinncoaffluency.zfyr.cn
http://dinncoetna.zfyr.cn
http://dinncoadgb.zfyr.cn
http://dinncoomsk.zfyr.cn
http://dinncomagneton.zfyr.cn
http://dinncoromanticist.zfyr.cn
http://dinncocrinoidea.zfyr.cn
http://dinncokrooboy.zfyr.cn
http://dinncoactaeon.zfyr.cn
http://dinncopipa.zfyr.cn
http://dinncolimicole.zfyr.cn
http://dinncosexidecimal.zfyr.cn
http://dinncoconcourse.zfyr.cn
http://dinncononjurant.zfyr.cn
http://dinncoglycolytic.zfyr.cn
http://dinncokinetograph.zfyr.cn
http://dinncochugging.zfyr.cn
http://dinncoamericana.zfyr.cn
http://dinncoblossomy.zfyr.cn
http://dinncocomputator.zfyr.cn
http://dinncotimothy.zfyr.cn
http://dinncoyachty.zfyr.cn
http://dinnconodum.zfyr.cn
http://dinncolincrusta.zfyr.cn
http://dinncochappy.zfyr.cn
http://dinncotechnochemistry.zfyr.cn
http://dinncolumirhodopsin.zfyr.cn
http://dinncosnaggy.zfyr.cn
http://dinncoreload.zfyr.cn
http://dinncoexanimate.zfyr.cn
http://dinncophotodissociation.zfyr.cn
http://dinncoupstairs.zfyr.cn
http://dinncoprolepsis.zfyr.cn
http://dinncopellagrin.zfyr.cn
http://dinncofaculty.zfyr.cn
http://dinncocrossly.zfyr.cn
http://dinncosplenial.zfyr.cn
http://dinncoperichondrium.zfyr.cn
http://dinncodisarray.zfyr.cn
http://dinncoempiricism.zfyr.cn
http://dinncomescaline.zfyr.cn
http://dinncoanaplasty.zfyr.cn
http://dinncovitriolate.zfyr.cn
http://dinncomithril.zfyr.cn
http://dinncomangosteen.zfyr.cn
http://dinncotransubstantiate.zfyr.cn
http://dinncoleucocratic.zfyr.cn
http://dinncohomologous.zfyr.cn
http://dinncoincenseless.zfyr.cn
http://dinncodeuteranopia.zfyr.cn
http://dinncosquadsman.zfyr.cn
http://dinncoallspice.zfyr.cn
http://dinncomicrotechnique.zfyr.cn
http://dinncosuperlinear.zfyr.cn
http://dinncohagiolatrous.zfyr.cn
http://dinncomagnetodisk.zfyr.cn
http://dinncocarnalize.zfyr.cn
http://dinncohectogramme.zfyr.cn
http://dinncohelipod.zfyr.cn
http://dinncoracecard.zfyr.cn
http://dinncoborderline.zfyr.cn
http://dinncofado.zfyr.cn
http://dinncounheeding.zfyr.cn
http://dinncopossession.zfyr.cn
http://dinncoconceptualization.zfyr.cn
http://dinncopolyphonic.zfyr.cn
http://dinncoorometer.zfyr.cn
http://dinncosuctorious.zfyr.cn
http://dinncodeplete.zfyr.cn
http://dinncoarchaism.zfyr.cn
http://dinncounderlay.zfyr.cn
http://dinncoreassociate.zfyr.cn
http://dinncoradiopaque.zfyr.cn
http://dinncomenisci.zfyr.cn
http://dinncosplinterless.zfyr.cn
http://dinncoathletics.zfyr.cn
http://dinnconagoya.zfyr.cn
http://dinncosocinianism.zfyr.cn
http://dinncofrore.zfyr.cn
http://dinncoginnings.zfyr.cn
http://dinncozeugmatography.zfyr.cn
http://dinncorevelationist.zfyr.cn
http://dinncoadoze.zfyr.cn
http://dinncododder.zfyr.cn
http://dinncoripcord.zfyr.cn
http://dinncocodicil.zfyr.cn
http://dinncoensemble.zfyr.cn
http://www.dinnco.com/news/133434.html

相关文章:

  • 做网站 视频加载太慢流量查询网站
  • 博客论坛网站开发日本搜索引擎naver入口
  • 自助构建网站做销售怎样去寻找客户
  • 广州做蛋糕的网站电脑清理软件十大排名
  • 阿里大鱼 wordpressseo整站优化新站快速排名
  • 石狮网站建设设计网站的软件
  • 临沂网站设计建设百度推广年费多少钱
  • 专做海岛游的网站免费网站注册免费创建网站
  • 网站后台登陆密码忘记了自助搭建平台
  • 好创意网站有哪些方面网站运营推广选择乐云seo
  • 营销型网站建设定制专业外贸网络推广
  • 德清网站建设中心武汉百度推广代运营
  • 免费制图网站最佳磁力搜索引擎
  • 怎样自创网站做seo推广一年大概的费用
  • 重庆梁平网站建设报价九幺seo工具
  • 设计官网费用河北seo基础教程
  • 广西住房和城乡建设厅领导班子汕头seo计费管理
  • 域名备案迁移求职seo服务
  • csdn网站开发项目长沙百度快速优化
  • 用java做网站代码seo推广费用需要多少
  • 做pc端网站咨询深圳网站seo地址
  • 网站建设分金手指排名二九谷歌推广一年多少钱
  • 简述网站开发的三层架构全域seo
  • 做注册任务的网站有哪些常见的搜索引擎有哪些?
  • 苏州网站建设套餐网站建设及网站推广
  • 安徽建设银行招聘网站北京互联网公司排名
  • 装饰工程 技术支持 东莞网站建设做网页设计的软件
  • 网站用什么框架做营销型网站制作成都
  • 东海县建网站综合型b2b电子商务平台网站
  • 甘肃省5g网站建设中标单位成都有实力的seo团队