简体   繁体   English

使用Java查询Active Directory以查找可用的CIFS共享

[英]Using Java to query Active Directory to find available CIFS shares

Here is the scenario: 这是场景:

I have several CIFS partitions which AD-based users can mount and use to access their files etc. 我有几个CIFS分区,基于AD的用户可以安装和使用这些分区来访问其文件等。

Now we have a requirement to expose this to users via Java-based Web application. 现在,我们需要通过基于Java的Web应用程序将其公开给用户。 So ideally when the users log in; 因此,理想情况下,当用户登录时; he/she should be able to see which all CIFS partitions he has access to. 他/她应该能够看到他有权访问的所有CIFS分区。 This would mean that that Java application should be able to query Active Directory server via LDAP or such to identify which all CIFS partitions are available and the respective ACLs . 这意味着Java应用程序应该能够通过LDAP或类似的查询Active Directory服务器,以识别所有可用的CIFS分区以及相应的ACLs

So the question is: 所以问题是:

  1. Can we use LDAP(Java-based library) to query AD to find out which users can access which CIFS shares? 我们可以使用LDAP(Java-based library)查询AD以确定哪些用户可以访问哪些CIFS共享吗?
  2. Is there any other way to do so from a Java application? Java应用程序还有其他方法可以做到吗?

There's no builtin way to publish CIFS partitions, or their respective ACLs, to AD. 没有内置的方法可以将CIFS分区或其各自的ACL发布到AD。 So you need to publish it yourself. 因此,您需要自己发布。 There's basically two options: 基本上有两种选择:

  1. Publish it in AD. 在AD中发布。 This requires extending the schema , ie creating a cIFSPartition class with two attributes, path and users. 这需要扩展架构 ,即创建具有两个属性path和users的cIFSPartition类。 You would then have to find a Java library that can perform LDAP queries (I see a lot of questions about Spring LDAP here). 然后,您将不得不找到一个可以执行LDAP查询的Java库(我在这里看到许多有关Spring LDAP的问题)。 You would probably need to make a webpage to help create and manage these cIFSPartition objects. 您可能需要制作一个网页来帮助创建和管理这些cIFSPartition对象。

  2. Store it on the webserver. 将其存储在网络服务器上。 You have lots of options here, like a text file or database. 您在这里有很多选择,例如文本文件或数据库。 This way, you don't have to worry about LDAP. 这样,您不必担心LDAP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM