类 UserPermissionEvaluator

java.lang.Object
com.cdkjframework.security.authorization.UserPermissionEvaluator
所有已实现的接口:
org.springframework.aop.framework.AopInfrastructureBean, org.springframework.security.access.PermissionEvaluator

@Component public class UserPermissionEvaluator extends Object implements org.springframework.security.access.PermissionEvaluator
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    boolean
    hasPermission(org.springframework.security.core.Authentication authentication, Serializable targetId, String targetType, Object permission)
    用于评估权限的替代方法,其中只有目标对象的标识符可用,而不是目标实例本身。
    boolean
    hasPermission(org.springframework.security.core.Authentication authentication, Object targetDomainObject, Object permission)
    hasPermission鉴权方法 这里仅仅判断PreAuthorize注解中的权限表达式 实际中可以根据业务需求设计数据库通过targetUrl和permission做更复杂鉴权 当然targetUrl不一定是URL可以是数据Id还可以是管理员标识等,这里根据需求自行设计

    从类继承的方法 java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • UserPermissionEvaluator

      public UserPermissionEvaluator()
  • 方法详细资料

    • hasPermission

      public boolean hasPermission(org.springframework.security.core.Authentication authentication, Object targetDomainObject, Object permission)
      hasPermission鉴权方法 这里仅仅判断PreAuthorize注解中的权限表达式 实际中可以根据业务需求设计数据库通过targetUrl和permission做更复杂鉴权 当然targetUrl不一定是URL可以是数据Id还可以是管理员标识等,这里根据需求自行设计
      指定者:
      hasPermission 在接口中 org.springframework.security.access.PermissionEvaluator
    • hasPermission

      public boolean hasPermission(org.springframework.security.core.Authentication authentication, Serializable targetId, String targetType, Object permission)
      用于评估权限的替代方法,其中只有目标对象的标识符可用,而不是目标实例本身。
      指定者:
      hasPermission 在接口中 org.springframework.security.access.PermissionEvaluator
      参数:
      authentication - 用户身份(在使用hasPermission表达式时Authentication参数默认会自动带上)
      targetId - 对象实例的标识符(通常为Long)
      targetType - 表示目标类型的字符串(通常是Java类名)。不为空。
      permission - 表达式系统提供的权限对象的表示形式。不为空。
      返回:
      如果权限被授予,则为true,否则为false