Compare commits

..

No commits in common. "c3b3e06a077f92f4e8158bbd5869b9ed46c2a5d1" and "893ab3381109e38297cc2b68cc0cbdeb3a6e9178" have entirely different histories.

3 changed files with 14 additions and 19 deletions

View File

@ -38,7 +38,7 @@ jobs:
tags: | tags: |
${{ env.IMAGE_FQDN }}:${{ env.IMAGE_TAG }} ${{ env.IMAGE_FQDN }}:${{ env.IMAGE_TAG }}
env: env:
IMAGE_TAG: ${{ startsWith(github.ref, 'refs/heads/main') && 'latest' || startsWith(github.ref, 'refs/heads/dev') && 'dev' || github.ref_name }} IMAGE_TAG: ${{ startsWith(github.ref, 'refs/heads/main') && 'latest' || startsWith(github.ref, 'refs/heads/dev') && 'dev' || github.ref_slug }}
if: startsWith(github.ref, 'refs/heads/') if: startsWith(github.ref, 'refs/heads/')
- name: Build with Tag - name: Build with Tag
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
@ -47,5 +47,5 @@ jobs:
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true push: true
tags: | tags: |
${{ env.IMAGE_FQDN }}:${{ github.ref_name }} ${{ env.IMAGE_FQDN }}:${{ github.ref }}
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')

View File

@ -34,4 +34,8 @@
- 保留页脚处版权信息。 - 保留页脚处版权信息。
- 保留源代码中的协议。 - 保留源代码中的协议。
- 如果修改了代码,则必须在文件中进行说明。 - 如果修改了代码,则必须在文件中进行说明。
● 允许
- 私用、商用、修改。

View File

@ -25,7 +25,6 @@ import java.util.*;
import javax.naming.Context; import javax.naming.Context;
import javax.naming.NamingEnumeration; import javax.naming.NamingEnumeration;
import javax.naming.NamingException; import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes; import javax.naming.directory.Attributes;
import javax.naming.directory.SearchControls; import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult; import javax.naming.directory.SearchResult;
@ -149,7 +148,7 @@ public class LdapUtil {
} }
// 唯一特征值 // 唯一特征值
String uSNCreated = getAttribute(attributes, "uSNCreated"); String uSNCreated = (String) attributes.get("uSNCreated").get();
if (StringUtil.isEmpty(uSNCreated)) { if (StringUtil.isEmpty(uSNCreated)) {
continue; continue;
} }
@ -254,16 +253,17 @@ public class LdapUtil {
ldapUser.setDn(item.getName()); ldapUser.setDn(item.getName());
// name解析 // name解析
String displayName = getAttribute(attributes, "displayName"); String displayName = (String) attributes.get("displayName").get();
if (StringUtil.isEmpty(displayName)) { if (StringUtil.isEmpty(displayName)) {
displayName = getAttribute(attributes, "cn"); displayName = (String) attributes.get("cn").get();
} }
ldapUser.setCn(displayName); ldapUser.setCn(displayName);
// 邮箱解析 // 邮箱解析
String email = getAttribute(attributes, "mail"); String email =
if (StringUtil.isEmpty(email)) { attributes.get("mail") == null ? null : (String) attributes.get("mail").get();
getAttribute(attributes, "email"); if (email == null) {
email = attributes.get("email") == null ? null : (String) attributes.get("email").get();
} }
ldapUser.setEmail(email); ldapUser.setEmail(email);
@ -296,15 +296,6 @@ public class LdapUtil {
return ldapUser; return ldapUser;
} }
private static String getAttribute(Attributes attributes, String keyName)
throws NamingException {
Attribute attribute = attributes.get(keyName);
if (attribute == null) {
return null;
}
return (String) attribute.get();
}
private static String baseDNOuScope(String baseDN) { private static String baseDNOuScope(String baseDN) {
List<String> ouScopes = new ArrayList<>(); List<String> ouScopes = new ArrayList<>();
String[] rdnList = baseDN.toLowerCase().split(","); String[] rdnList = baseDN.toLowerCase().split(",");