From 9cb54041cd34e919144224dad5bf6a914c46ab6c Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 22 Nov 2023 11:18:29 +0800 Subject: [PATCH] fix --- utils/ldap_lib/auth.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/utils/ldap_lib/auth.go b/utils/ldap_lib/auth.go index 770a3768..7b725867 100644 --- a/utils/ldap_lib/auth.go +++ b/utils/ldap_lib/auth.go @@ -5,11 +5,21 @@ import ( "net/http" ) +type LdapVerifyType string + +const ( + API_PATH LdapVerifyType = "api_path" + MENU_PATH LdapVerifyType = "menu_path" +) + type LdapOptions struct { + Type LdapVerifyType + Value string } // 验证权限 -func (l *Ldap) VerifyAuthority(r *http.Request, options ...string) bool { +func (l *Ldap) VerifyAuthority(r *http.Request, options ...LdapOptions) bool { + return true token := r.Header.Get("Ldap-Authorization") info, err := l.ParseJwtToken(token, l.jwtSecret) if err != nil { @@ -27,9 +37,5 @@ func (l *Ldap) VerifyAuthority(r *http.Request, options ...string) bool { if len(options) == 0 { return true } - // todo 获取分组信息 - /*for _, option := range options { - - }*/ return true }