接口 SecurityContext
public interface SecurityContext
Security context in which an endpoint is being invoked.- 从以下版本开始:
- 2.0.0
字段概要
字段 修饰符和类型 字段 说明 static SecurityContextNONEEmpty security context.
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 PrincipalgetPrincipal()Return the currently authenticatedPrincipalornull.booleanisUserInRole(String role)Returnstrueif the currently authenticated user is in the givenrole, or false otherwise.
字段详细资料
NONE
static final SecurityContext NONE
Empty security context.
方法详细资料
getPrincipal
Principal getPrincipal()
Return the currently authenticatedPrincipalornull.- 返回:
- the principal or
null
isUserInRole
boolean isUserInRole(String role)
Returnstrueif the currently authenticated user is in the givenrole, or false otherwise.- 参数:
role- name of the role- 返回:
trueif the user is in the given role