• Spring Security 安全验证


    摘自:https://www.cnblogs.com/shiyu404/p/6530894.html

    这篇文章是对Spring Security的Authentication模块进行一个初步的概念了解,知道它是如何进行用户认证的

    考虑一个大家比较熟悉的标准认证过程:

    1.用户使用username和password登录

    2.系统验证这个password对于该username是正确的

    3.假设第二步验证成功,获取该用户的上下文信息(如他的角色列表)

    4.围绕该用户建立安全上下文(security context)

    5.用户可能继续进行的一些操作被一个验证控制机制潜在的管理,这个验证机制会根据当前用户的安全上下文来验证权限。

    认证过程就是又前三项构成的。在Spring Security中是这样处理这三部分的:

    1.username和password被获得后封装到一个UsernamePasswordAuthenticationToken(Authentication接口的实例)的实例中

    2.这个token被传递给AuthenticationManager进行验证

    3.成功认证后AuthenticationManager将返回一个得到完整填充的Authentication实例

    4.通过调用SecurityContextHolder.getContext().setAuthentication(...),参数传递authentication对象,来建立安全上下文(security context)

  • 相关阅读:
    NetBeans 时事通讯(刊号 # 143 Apr 19, 2011)
    道道道
    係要听ROCK N' ROLL
    JPA 缓存与应用集群
    NetBeans 时事通讯(刊号 # 144 Apr 28, 2011)
    係要听ROCK N' ROLL
    道道道
    JPA 缓存与应用集群
    twemproxy (nutcracker) Build Status
    Java 与 C进行Socket通讯
  • 原文地址:https://www.cnblogs.com/rdchen/p/10690961.html
Copyright © 2020-2023  润新知