KissoAuthorization.kt 748 B

1234567891011121314151617181920
  1. package com.gxzc.zen.ump
  2. import com.baomidou.kisso.SSOAuthorization
  3. import com.baomidou.kisso.security.token.SSOToken
  4. import com.gxzc.zen.api.sys.service.ISysPermissionService
  5. import com.gxzc.zen.common.util.SpringContextHolder
  6. import org.apache.commons.lang3.StringUtils
  7. class KissoAuthorization:SSOAuthorization {
  8. private val permissionService=SpringContextHolder.getBean(ISysPermissionService::class.java)
  9. override fun isPermitted(token: SSOToken?, permission: String?): Boolean {
  10. if(token==null)return false
  11. if(!StringUtils.isNumeric(token.id))return false
  12. val pers=permissionService?.findUserPermissions(token?.id?.toLong()!!)
  13. if(pers?.contains(permission)!!)return true
  14. return false
  15. }
  16. }