2019独角兽企业重金招聘Python工程师标准>>>

先上一张图,如下图1所示:

图1 UserDetails的类图

UserDetails这个类的目的,《Pro Spring Security》的chapter3中,原文,"The interface org.springframework.security.core.userdetails.UserDetails object is the main abstraction in the system, and it’s used to represent a full user in the context of Spring Security. It is also made available to be accessed later in the system from any point that has access to SecurityContext. Normally, developers create their own implementation of this interface to store particular user details they need or want (like email, telephone, address, and so on). Later, they can access this information, which will be encapsulated in the Authentication object, and they can be obtained by calling the getPrincipal method on it"

我们可以自己实现这个Userdetails接口,保存我们想要的用户信息,之后将这个UserDetails的实现类放在Authentication中,通过Authentication.getPrincipal()获得。

转载于:https://my.oschina.net/u/2518341/blog/1976176

Springsecurity之UserDetails相关推荐

  1. SpringSecurity用数据库信息做认证

    初步实现认证功能 让我们自己的UserService接口继承UserDetailsService,毕竟SpringSecurity是只认UserDetailsService的: 创建UserDetai ...

  2. SpringSecurity加密认证

    加密认证 在IOC容器中提供加密对象 <!--加密对象--> <bean id="passwordEncoder" class="org.springf ...

  3. jwt判断token是否过期_4spring-security5整合jwt做登录、权限验证,全网最全!!!可用...

    github源码: https://github.com/gyb123456/spring-security5-jwt,最烦那些写文档只截图一半还不给源码的人,要不你就截全图,要不就给源码! 前言: ...

  4. 好码推荐-一个符合我口味的SpringBoot(2.0.5)+MybatisPlus(3.0.7)项目骨架

    SpringBoot(2.0.5)+MybatisPlus(3.0.7)项目骨架,支持SpringSecurity+JWT权限验证,整合Redis+MongoDB+RabbitMQ+Elasticse ...

  5. Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException

    问题描述 整合SpringSecurity时, 认证通过后把LoginUser信息存储到redis缓存中: 校验token通过后,读取redis缓存中的LoginUser数据失败,报错: Caused ...

  6. SpringBoot+SpringSecurity前后端分离+Jwt的权限认证(改造记录)

    欢迎关注方志朋的博客,回复"666"获面试宝典 来源:blog.csdn.net/zzzgd_666/article/details/96444829 前言 一般来说,我们用Spr ...

  7. echarts前后端交互数据_SpringBoot2.0实战(26)整合SpringSecurity前后端分离JSON交互...

    在前端的文章中,我们实现了使用 SpringSecurity 实现登录鉴权,并使用数据库存储用户信息,实现登录鉴权 SpringBoot2.0实战(24)整合SpringSecurity之最简登录方法 ...

  8. 【Spring框架家族】Spring--Security权限控制密码加密

    Spring Security简介 Spring Security是 Spring提供的安全认证服务的框架. 使用Spring Security可以帮助我们来简化认证 和授权的过程.官网:https: ...

  9. springboot 按钮权限验证_springboot学习之权限系统登录验证SpringSecurity

    SpringSecurity核心功能:认证.授权.攻击防护(防止伪造身份) 涉及的依赖如下: org.springframework.boot spring-boot-starter-security ...

最新文章

  1. Session——servlet
  2. 键盘按下某键 停止运行java_实现按下一个键执行操作/松开一个键停止操作
  3. Java八大基本数据类型和对应的封装类型
  4. 跟我一起学Redis之高可用从主从复制开始
  5. 掌握这四点核心思想,统计学才算入门
  6. 实验五 — — Java网络编程及安全
  7. 蓝桥杯真题训练 2019.3题
  8. mysql之使用json
  9. 一起来作画吧「GitHub 热点速览 v.22.14」
  10. 计算机同步不了计算机策略,修复sysvol netlog共享和组策略不同步组策略丢失等问题...
  11. 寄存器与ROM与RAM
  12. Question | 怎样有效杜绝“羊毛党“的薅羊毛行为?
  13. MFC--按键、按钮按下和弹起事件检测
  14. BaseFX 实习小记(一)
  15. SparkStreaming面试题
  16. 计划驱动的软件过程:waterfall model(瀑布模型,或称之为SDLC模型)
  17. 最快接收计算机sci,投稿到接收仅用四天,这大概是发表最快的sci了!?
  18. 面试时如何回答面试官的问题
  19. 2015年:跑步计划
  20. NTLite 1 2 0 4453授权注册版

热门文章

  1. Java秒杀系统实战系列~分布式唯一ID生成订单编号
  2. 雷林鹏分享:MySQL DELETE 语句
  3. 计数器:counter
  4. 判断字符串中是否包含指定字符的N种方法对比
  5. JVM参数之-XX:+HeapDumpOnOutOfMemoryError(导出内存溢出的堆信息(hprof文件))
  6. iOS: AFNetworking手动配置(iOS7.1, AF2.2.4)
  7. tolua++ 使用有感
  8. YOLO系列专题——YOLOv1理论篇
  9. (2)通过输入参数(测量数据)构建三维体模型(01)
  10. linux修改jdk文件保存,Linux下更换jdk和配置环境变量详解