SpEL表達式說明:網絡
用於匹配一個請求的IP 地址或一個地址的網絡掩碼spa
access="hasIpAddress('162.79.8.30')"orm
access="hasIpAddress('162.0.0.0/224')"對象
用於匹配一個使用GrantedAuthority 的角色(相似於 RoleVoter)隊列
access="hasRole('ROLE_USER')"ip
用於匹配一個使用GrantedAuthority 的角色列表。用戶匹配其中的任何一個都可放行。ci
access="hasRole('ROLE_USER','ROLE_ADMIN')"rem
任何用戶都可訪問 字符串
access="permitAll"it
任何用戶均不可訪問
access="denyAll"
匿名用戶可訪問
access="anonymous"
檢查用戶是否定證過
access="authenticated"
檢查用戶是否經過remember me 功能認證的
access="rememberMe"
檢查用戶是否經過提供完整的憑證信息來認證的
access="fullyAuthenticated"
hasRole([role]) 返回 true 若是當前主體擁有特定角色。
hasAnyRole([role1,role2]) 返回 true 若是當前主體擁有任何一個提供的角色 (使用逗號分隔的字符串隊列)
principal 容許直接訪問主體對象,表示當前用戶
authentication 容許直接訪問當前 Authentication對象 從SecurityContext中得到
permitAll 一直返回true
denyAll 一直返回false
isAnonymous() 若是用戶是一個匿名登陸的用戶 就會返回 true
isRememberMe() 若是用戶是經過remember-me 登陸的用戶 就會返回 true
isAuthenticated() 若是用戶不是匿名用戶就會返回true
isFullyAuthenticated() 若是用戶不是經過匿名也不是經過remember-me登陸的用戶時, 就會返回true。