spring-security(七)

spring-security(七)

摘自《pro spring security》基于spring security 4.2.2.RELEASE

SecurityContext and SecurityContextHolder

org.springframework.security.core.context.SecurityContext(实际上是它的实现类SecurityContextImpl),就是spring security存储有效Authentication object的地方,并且与当前线程绑定。org.springframework.security.core.context.SecurityContextHolder是可以在框架中用来去访问SecurityContext,代理了可配置策略去处理这些SecurityContext,比如线程绑定的SecurityContext(默认),或者是全局的SecurityContext

spring-security(七)_第1张图片

public interface SecurityContext extends Serializable {

    Authentication getAuthentication();

    void setAuthentication(Authentication authentication);
}

你可能感兴趣的:(security)