package ldap_lib import ( "github.com/zeromicro/go-zero/core/logx" "net/http" ) // 验证权限 func (l *Ldap) VerifyAuthority(r *http.Request, jwtSecret string) bool { token := r.Header.Get("Ldap-Authorization") info, err := l.ParseJwtToken(token, jwtSecret) if err != nil { logx.Error("解析token失败", err, "----token:", token) return false } //查询ldap userInfo, err := l.GetLdapUserInfo(info.UserDN) if err != nil { logx.Error("获取ldap用户信息失败", err, "----user_dn:", info.UserDN) } if userInfo.Status != 1 { return false } // TODO 查询权限组相关信息 return true }