类 AuthorizationManager

java.lang.Object
com.mbap.gateway.component.AuthorizationManager
所有已实现的接口:
org.springframework.security.authorization.ReactiveAuthorizationManager<org.springframework.security.web.server.authorization.AuthorizationContext>

@Component("AuthorizationManager") @RefreshScope public class AuthorizationManager extends Object implements org.springframework.security.authorization.ReactiveAuthorizationManager<org.springframework.security.web.server.authorization.AuthorizationContext>
鉴权管理器,用于判断是否有资源的访问权限
作者:
Amanda.Z
  • 构造器概要

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

    修饰符和类型
    方法
    说明
    reactor.core.publisher.Mono<org.springframework.security.authorization.AuthorizationDecision>
    check(reactor.core.publisher.Mono<org.springframework.security.core.Authentication> mono, org.springframework.security.web.server.authorization.AuthorizationContext authorizationContext)
    权限检查
    getFinalPath(org.springframework.web.server.ServerWebExchange exchange)
    获取完全访问地址
    static String
    getHeadProperties(org.springframework.http.server.reactive.ServerHttpRequest request, String headName)
    获取请求头中的信息
    com.alibaba.fastjson.JSONObject
    getRealPath(org.springframework.http.server.reactive.ServerHttpRequest request)
    根据访问URL获取接口真实地址,主要区分实际请求和路径传参的请求
    void
     
    static boolean
    ipMatch(List<Object> regList, String ipAddress)
    判断某个地址,是否包含在IP白名单或黑名单
    boolean
    permitAll(String requestPath)
    校验是否属于免验证的资源

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

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    从接口继承的方法 org.springframework.security.authorization.ReactiveAuthorizationManager

    verify
  • 构造器详细资料

    • AuthorizationManager

      public AuthorizationManager()
  • 方法详细资料

    • init

      @PostConstruct public void init()
    • getFinalPath

      public String getFinalPath(org.springframework.web.server.ServerWebExchange exchange)
      获取完全访问地址
      返回:
    • check

      public reactor.core.publisher.Mono<org.springframework.security.authorization.AuthorizationDecision> check(reactor.core.publisher.Mono<org.springframework.security.core.Authentication> mono, org.springframework.security.web.server.authorization.AuthorizationContext authorizationContext)
      权限检查
      指定者:
      check 在接口中 org.springframework.security.authorization.ReactiveAuthorizationManager<org.springframework.security.web.server.authorization.AuthorizationContext>
    • permitAll

      public boolean permitAll(String requestPath)
      校验是否属于免验证的资源
      参数:
      requestPath - 请求路径
      返回:
    • getHeadProperties

      public static String getHeadProperties(org.springframework.http.server.reactive.ServerHttpRequest request, String headName)
      获取请求头中的信息
      参数:
      request - 请求对象
      headName - 头信息中对应的名称,如果取ip,则直接传ip
      返回:
    • getRealPath

      public com.alibaba.fastjson.JSONObject getRealPath(org.springframework.http.server.reactive.ServerHttpRequest request)
      根据访问URL获取接口真实地址,主要区分实际请求和路径传参的请求
      参数:
      request - 请求对象
      返回:
    • ipMatch

      public static boolean ipMatch(List<Object> regList, String ipAddress)
      判断某个地址,是否包含在IP白名单或黑名单
      参数:
      regList - ip名单,各个ip逗号分隔,ip段用/分开。 如 String regList = "192.168.100.2,192.168.10.10/12"; 表示 192.168.100.2,192.168.10.10,192.168.10.11,192.168.10.12
      ipAddress - 需要验证的IP地址
      返回: