本节我们将讨论安全上下文,我们将分析它是如何工作的、如何从其中访问数据,以及应用程序如何在具有不同的与线程有关的场景中管理它。一般来说,我们为了让后续程序能够使用验证通过人员的信息,都会使用到它,比如编写一个SecurityUtils用来获取用户信息是经常用到的,那么学习它后,你就可以使用安全上下文存储关于已验证用户的详细信息了。 我们上文学习了AuthenticationProvider对身份验证的整个流程,一旦AuthenticationManager成功完成身份验证,它将为请求的其余部分存储Authentication实例,这个实例就被称为安全上下文 Spring Security的安全上下文是由SpringContext接口描述的。接口代码如下: public interface SecurityContext extends Serializable { Authentication getAuthentication(); void setAuthentication(Authentication authentication); }...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile