Spring框架中SecurityContextHolder類的使用詳解(未完待續)
阿新 • • 發佈:2019-01-02
To specify which strategy should be used, you must provide a mode setting. A mode setting is one of the three valid
MODE_ settings defined as static final fields, or a fully qualified classname to a concrete implementation of
SecurityContextHolderStrategy that provides a public no-argument constructor.
There are two ways to specify the desired strategy mode String. The first is to specify it via the system property
keyed on SYSTEM_PROPERTY. The second is to call setStrategyName(String) before using the class. If neither approach is used,
the class will default to using MODE_THREADLOCAL, which is backwards compatible, has fewer JVM incompatibilities and is
appropriate on servers (whereas MODE_GLOBAL is definitely inappropriate for server use).
SecurityContextHolder 類提供了8個成員方法,大部分都是static型別:
static SecurityContext getContext() 通過這個方法獲得當前的SecurityContext
MODE_ settings defined as static final fields, or a fully qualified classname to a concrete implementation of
SecurityContextHolderStrategy that provides a public no-argument constructor.
There are two ways to specify the desired strategy mode String. The first is to specify it via the system property
keyed on SYSTEM_PROPERTY. The second is to call setStrategyName(String) before using the class. If neither approach is used,
the class will default to using MODE_THREADLOCAL, which is backwards compatible, has fewer JVM incompatibilities and is
appropriate on servers (whereas MODE_GLOBAL is definitely inappropriate for server use).
SecurityContextHolder 類提供了8個成員方法,大部分都是static型別:
static SecurityContext getContext() 通過這個方法獲得當前的SecurityContext