This commit is contained in:
laodaming
2023-11-22 10:47:19 +08:00
parent 50e8a42e34
commit 760d9928dc
3 changed files with 15 additions and 27 deletions

View File

@@ -5,8 +5,11 @@ import (
"net/http"
)
type LdapOptions struct {
}
// 验证权限
func (l *Ldap) VerifyAuthority(r *http.Request) bool {
func (l *Ldap) VerifyAuthority(r *http.Request, options ...string) bool {
token := r.Header.Get("Ldap-Authorization")
info, err := l.ParseJwtToken(token, l.jwtSecret)
if err != nil {
@@ -21,6 +24,12 @@ func (l *Ldap) VerifyAuthority(r *http.Request) bool {
if userInfo.Status != 1 {
return false
}
// TODO 查询权限组相关信息
if len(options) == 0 {
return true
}
// todo 获取分组信息
/*for _, option := range options {
}*/
return true
}