接口 SecurityContext
public interface SecurityContext
Security context in which an endpoint is being invoked.- 从以下版本开始:
- 2.0.0
字段概要
字段 修饰符和类型 字段 说明 static SecurityContext
NONE
Empty security context.
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 Principal
getPrincipal()
Return the currently authenticatedPrincipal
ornull
.boolean
isUserInRole(String role)
Returnstrue
if 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 authenticatedPrincipal
ornull
.- 返回:
- the principal or
null
isUserInRole
boolean isUserInRole(String role)
Returnstrue
if the currently authenticated user is in the givenrole
, or false otherwise.- 参数:
role
- name of the role- 返回:
true
if the user is in the given role